Register runner with renamed paused argument

What does this MR do?

This MR renamed the active field in the runner registration request to paused, to follow the change that was done on the GitLab side (gitlab#347211 (closed)).

Why was this MR needed?

To ensure that the Runner can register with newer versions of GitLab. The old active field will be removed in %16.0.

What's the best way to test this MR?

Register a runner with a recent version of GitLab (> %14.8). It should still be successful since GitLab versions between %14.8 and %16.0 accept both paused and active as synonyms.

I'm not yet sure what is the correct process to introduce this change on the Runner side, so I left a question in the issue.

What are the relevant issue numbers?

Closes #28844 (closed)

Edited by Pedro Pombeiro

Merge request reports

Loading
+1 −1
Changes for commands/register.go: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -263,7 +263,7 @@ func (s *RegisterCommand) askRunner() {
		AccessLevel:     s.AccessLevel,
		RunUntagged:     s.RunUntagged,
		MaximumTimeout:  s.MaximumTimeout,
		Active:          !s.Paused,
		Paused:          s.Paused,
	}

	result := s.network.RegisterRunner(s.RunnerCredentials, parameters)
+6 −4
Changes for commands/register_integration_test.go: 6 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -231,7 +231,7 @@ func testAskRunnerOverrideDefaultsForExecutor(t *testing.T, executor string) {
					MaintenanceNote: "basic notes",
					Tags:            "tag,list",
					Locked:          true,
					Active:          true,
					Paused:          false,
				}
			},
		},
@@ -253,6 +253,7 @@ func testAskRunnerOverrideDefaultsForExecutor(t *testing.T, executor string) {
					Description:     "name",
					MaintenanceNote: "maintainer notes",
					Tags:            "tag,list",
					Paused:          true,
				}
			},
		},
@@ -276,6 +277,7 @@ func testAskRunnerOverrideDefaultsForExecutor(t *testing.T, executor string) {
					Description:     "new-name",
					MaintenanceNote: "maintainer notes",
					Tags:            "tag,list",
					Paused:          true,
				}
			},
		},
@@ -293,7 +295,7 @@ func testAskRunnerOverrideDefaultsForExecutor(t *testing.T, executor string) {
					Description: "name",
					RunUntagged: true,
					Locked:      true,
					Active:      true,
					Paused:      false,
				}
			},
		},
@@ -312,7 +314,7 @@ func testAskRunnerOverrideDefaultsForExecutor(t *testing.T, executor string) {
					Description: "name",
					RunUntagged: true,
					Locked:      true,
					Active:      true,
					Paused:      false,
				}
			},
		},
@@ -332,7 +334,7 @@ func testAskRunnerOverrideDefaultsForExecutor(t *testing.T, executor string) {
					Tags:        "tag,list",
					RunUntagged: true,
					Locked:      true,
					Active:      true,
					Paused:      false,
				}
			},
		},
+1 −1
Changes for common/network.go: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -105,7 +105,7 @@ type RegisterRunnerParameters struct {
	Locked          bool   `json:"locked"`
	AccessLevel     string `json:"access_level,omitempty"`
	MaximumTimeout  int    `json:"maximum_timeout,omitempty"`
	Active          bool   `json:"active"`
	Paused          bool   `json:"paused"`
}

type RegisterRunnerRequest struct {
+2
Changes for docs/register/index.md: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -7,6 +7,8 @@ comments: false

# Registering runners **(FREE)**

> [Introduced](https://gitlab.com/gitlab-org/gitlab-runner/-/merge_requests/3414) in GitLab Runner 15.0, a change to the registration request format prevents the GitLab Runner from communicating with GitLab versions lower than 14.8. You must use a Runner version that is appropriate for the GitLab version, or upgrade the GitLab application.

Registering a runner is the process that binds the runner with one or more GitLab instances.

You can register multiple runners on the same host machine,
+8 −3
Changes for docs/index.md: 8 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -31,7 +31,8 @@ should [plan for how you will monitor and adjust performance for these runners](

## GitLab Runner versions

For compatibility reasons, the GitLab Runner [major.minor](https://en.wikipedia.org/wiki/Software_versioning) version should stay in sync with the GitLab major and minor version. Older runners may still work
For compatibility reasons, the GitLab Runner [major.minor](https://en.wikipedia.org/wiki/Software_versioning) version
should stay in sync with the GitLab major and minor version. Older runners may still work
with newer GitLab versions, and vice versa. However, features may be not available or work properly
if a version difference exists.

@@ -39,9 +40,13 @@ Backward compatibility is guaranteed between minor version updates. However, som
version updates of GitLab can introduce new features that require GitLab Runner to be on the same minor
version.

NOTE:
GitLab Runner 15.0 [introduced](https://gitlab.com/gitlab-org/gitlab-runner/-/merge_requests/3414) a change to the
registration API request format. It prevents the GitLab Runner from communicating with GitLab versions lower than 14.8.
You must use a Runner version that is appropriate for the GitLab version, or upgrade the GitLab application.

If you host your own runners but host your repositories on GitLab.com,
keep GitLab Runner [updated](install/index.md)
to the latest version, as GitLab.com is
keep GitLab Runner [updated](install/index.md) to the latest version, as GitLab.com is
[updated continuously](https://gitlab.com/gitlab-org/release/tasks/-/issues).

## Runner registration
Loading
Loading