API: Runner not_connected status removal
Description
Runner REST and GraphQL APIs will return never_contacted
instead of not_connected
as a status in GitLab 15.0.
Deprecated as of 14.6
- Runners that have not connected during a period under 3 months will return
never_connected
. Runners that have not connected for more than 3 months will returnstale
instead.
Implementation details
The Runner REST API contains a status
attribute which should match our current GraphQL implementation. In order to remove the deprecation, the following change would have to be applied (not comprehensive):
diff --git a/app/graphql/types/ci/runner_status_enum.rb b/app/graphql/types/ci/runner_status_enum.rb
index 0eabbb4d619..908ab138778 100644
--- a/app/graphql/types/ci/runner_status_enum.rb
+++ b/app/graphql/types/ci/runner_status_enum.rb
@@ -28,13 +28,8 @@ class RunnerStatusEnum < BaseEnum
description: "Runner that has not contacted this instance within the last #{::Ci::Runner::STALE_TIMEOUT.inspect}. Only available if legacyMode is null. Will be a possible return value starting in 15.0.",
value: :stale
- value 'NOT_CONNECTED',
- description: 'Runner that has never contacted this instance.',
- deprecated: { reason: "Use NEVER_CONTACTED instead. NEVER_CONTACTED will have a slightly different scope starting in 15.0, with STALE being returned instead after #{::Ci::Runner::STALE_TIMEOUT.inspect} of no contact", milestone: '14.6' },
- value: :not_connected
-
value 'NEVER_CONTACTED',
- description: 'Runner that has never contacted this instance. Only returned if legacyMode is null. Will replace NOT_CONNECTED starting in 15.0.',
+ description: 'Runner that has never contacted this instance.',
value: :never_contacted
end
end
diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb
index bec1ad1694e..4484a0167e7 100644
--- a/app/models/ci/runner.rb
+++ b/app/models/ci/runner.rb
@@ -282,27 +282,13 @@ def stale?
[created_at, contacted_at].compact.max < self.class.stale_deadline
end
- def status(legacy_mode = nil)
- return deprecated_rest_status if legacy_mode == '14.5'
-
+ def status
return :stale if stale?
return :never_contacted unless contacted_at
online? ? :online : :offline
end
- # DEPRECATED
- # TODO Remove in %15.0 in favor of `status` for REST calls, see https://gitlab.com/gitlab-org/gitlab/-/issues/344648
- def deprecated_rest_status
- if contacted_at.nil?
- :not_connected
- elsif active?
- online? ? :online : :offline
- else
- :paused
- end
- end
-
def belongs_to_one_project?
runner_projects.count == 1
end
diff --git a/lib/api/entities/ci/runner.rb b/lib/api/entities/ci/runner.rb
index 60193fe1df4..ede698696de 100644
--- a/lib/api/entities/ci/runner.rb
+++ b/lib/api/entities/ci/runner.rb
@@ -12,9 +12,7 @@ class Runner < Grape::Entity
expose :runner_type
expose :name
expose :online?, as: :online
- # DEPRECATED
- # TODO Remove in %15.0 in favor of `status` for REST calls, see https://gitlab.com/gitlab-org/gitlab/-/issues/344648
- expose :status, as: :deprecated_rest_status
+ expose :status
end
end
end
Links
Removal MR: !86111 (merged)
Edited by Pedro Pombeiro