Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/graphql/types/ci/runner_type.rb')
-rw-r--r--app/graphql/types/ci/runner_type.rb49
1 files changed, 17 insertions, 32 deletions
diff --git a/app/graphql/types/ci/runner_type.rb b/app/graphql/types/ci/runner_type.rb
index 8e509cc8493..2baf64ca663 100644
--- a/app/graphql/types/ci/runner_type.rb
+++ b/app/graphql/types/ci/runner_type.rb
@@ -24,8 +24,9 @@ module Types
field :admin_url, GraphQL::Types::String, null: true,
description: 'Admin URL of the runner. Only available for administrators.'
field :architecture_name, GraphQL::Types::String, null: true,
- description: 'Architecture provided by the the runner.',
- method: :architecture
+ deprecated: { reason: "Use field in `manager` object instead", milestone: '16.2' },
+ description: 'Architecture provided by the the runner.',
+ method: :architecture
field :contacted_at, Types::TimeType, null: true,
description: 'Timestamp of last contact from this runner.',
method: :contacted_at
@@ -46,17 +47,20 @@ module Types
description: 'URL of the registration page of the runner manager. Only available for the creator of the runner for a limited time during registration.',
alpha: { milestone: '15.11' }
field :executor_name, GraphQL::Types::String, null: true,
- description: 'Executor last advertised by the runner.',
- method: :executor_name
+ deprecated: { reason: "Use field in `manager` object instead", milestone: '16.2' },
+ description: 'Executor last advertised by the runner.',
+ method: :executor_name
field :groups, null: true,
resolver: ::Resolvers::Ci::RunnerGroupsResolver,
description: 'Groups the runner is associated with. For group runners only.'
field :id, ::Types::GlobalIDType[::Ci::Runner], null: false,
description: 'ID of the runner.'
field :ip_address, GraphQL::Types::String, null: true,
- description: 'IP address of the runner.'
+ deprecated: { reason: "Use field in `manager` object instead", milestone: '16.2' },
+ description: 'IP address of the runner.'
field :job_count, GraphQL::Types::Int, null: true,
- description: "Number of jobs processed by the runner (limited to #{JOB_COUNT_LIMIT}, plus one to indicate that more items exist)."
+ description: "Number of jobs processed by the runner (limited to #{JOB_COUNT_LIMIT}, plus one to indicate that more items exist).",
+ resolver: ::Resolvers::Ci::RunnerJobCountResolver
field :job_execution_status,
Types::Ci::RunnerJobExecutionStatusEnum,
null: true,
@@ -82,8 +86,9 @@ module Types
field :paused, GraphQL::Types::Boolean, null: false,
description: 'Indicates the runner is paused and not available to run jobs.'
field :platform_name, GraphQL::Types::String, null: true,
- description: 'Platform provided by the runner.',
- method: :platform
+ deprecated: { reason: "Use field in `manager` object instead", milestone: '16.2' },
+ description: 'Platform provided by the runner.',
+ method: :platform
field :project_count, GraphQL::Types::Int, null: true,
description: 'Number of projects that the runner is associated with.'
field :projects,
@@ -94,7 +99,8 @@ module Types
field :register_admin_url, GraphQL::Types::String, null: true,
description: 'URL of the temporary registration page of the runner. Only available before the runner is registered. Only available for administrators.'
field :revision, GraphQL::Types::String, null: true,
- description: 'Revision of the runner.'
+ deprecated: { reason: "Use field in `manager` object instead", milestone: '16.2' },
+ description: 'Revision of the runner.'
field :run_untagged, GraphQL::Types::Boolean, null: false,
description: 'Indicates the runner is able to run untagged jobs.'
field :runner_type, ::Types::Ci::RunnerTypeEnum, null: false,
@@ -112,7 +118,8 @@ module Types
description: 'Runner token expiration time.',
method: :token_expires_at
field :version, GraphQL::Types::String, null: true,
- description: 'Version of the runner.'
+ deprecated: { reason: "Use field in `manager` object instead", milestone: '16.2' },
+ description: 'Version of the runner.'
markdown_field :maintenance_note_html, null: true
@@ -120,28 +127,6 @@ module Types
::MarkupHelper.markdown(object.maintenance_note, context.to_h.dup)
end
- def job_count
- BatchLoader::GraphQL.for(runner.id).batch(key: :job_count) do |runner_ids, loader, _args|
- # rubocop: disable CodeReuse/ActiveRecord
- # We limit to 1 above the JOB_COUNT_LIMIT to indicate that more items exist after JOB_COUNT_LIMIT
- builds_tbl = ::Ci::Build.arel_table
- runners_tbl = ::Ci::Runner.arel_table
- lateral_query = ::Ci::Build.select(1)
- .where(builds_tbl['runner_id'].eq(runners_tbl['id']))
- .limit(JOB_COUNT_LIMIT + 1)
- counts = ::Ci::Runner.joins("JOIN LATERAL (#{lateral_query.to_sql}) builds_with_limit ON true")
- .id_in(runner_ids)
- .select(:id, Arel.star.count.as('count'))
- .group(:id)
- .index_by(&:id)
- # rubocop: enable CodeReuse/ActiveRecord
-
- runner_ids.each do |runner_id|
- loader.call(runner_id, counts[runner_id]&.count || 0)
- end
- end
- end
-
def admin_url
Gitlab::Routing.url_helpers.admin_runner_url(runner) if can_admin_runners?
end