diff options
Diffstat (limited to 'app/graphql/types/ci/runner_type.rb')
-rw-r--r-- | app/graphql/types/ci/runner_type.rb | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/app/graphql/types/ci/runner_type.rb b/app/graphql/types/ci/runner_type.rb index 10d18f9ad2a..60ea78752ca 100644 --- a/app/graphql/types/ci/runner_type.rb +++ b/app/graphql/types/ci/runner_type.rb @@ -14,9 +14,6 @@ module Types JOB_COUNT_LIMIT = 1000 - # Only allow ephemeral_authentication_token to be visible for a short while - RUNNER_EPHEMERAL_TOKEN_AVAILABILITY_TIME = 3.hours - alias_method :runner, :object field :access_level, ::Types::Ci::RunnerAccessLevelEnum, null: false, @@ -34,12 +31,15 @@ module Types method: :contacted_at field :created_at, Types::TimeType, null: true, description: 'Timestamp of creation of this runner.' + field :created_by, Types::UserType, null: true, + description: 'User that created this runner.', + method: :creator field :description, GraphQL::Types::String, null: true, description: 'Description of the runner.' field :edit_admin_url, GraphQL::Types::String, null: true, description: 'Admin form URL of the runner. Only available for administrators.' field :ephemeral_authentication_token, GraphQL::Types::String, null: true, - description: 'Ephemeral authentication token used for runner machine registration.', + description: 'Ephemeral authentication token used for runner machine registration. Only available for the creator of the runner for a limited time during registration.', authorize: :read_ephemeral_token, alpha: { milestone: '15.9' } field :executor_name, GraphQL::Types::String, null: true, @@ -58,13 +58,17 @@ module Types Types::Ci::RunnerJobExecutionStatusEnum, null: true, description: 'Job execution status of the runner.', - deprecated: { milestone: '15.7', reason: :alpha } + alpha: { milestone: '15.7' } field :jobs, ::Types::Ci::JobType.connection_type, null: true, description: 'Jobs assigned to the runner. This field can only be resolved for one runner in any single request.', authorize: :read_builds, resolver: ::Resolvers::Ci::RunnerJobsResolver field :locked, GraphQL::Types::Boolean, null: true, description: 'Indicates the runner is locked.' + field :machines, ::Types::Ci::RunnerMachineType.connection_type, null: true, + description: 'Machines associated with the runner configuration.', + method: :runner_machines, + alpha: { milestone: '15.10' } field :maintenance_note, GraphQL::Types::String, null: true, description: 'Runner\'s maintenance notes.' field :maximum_timeout, GraphQL::Types::Int, null: true, @@ -84,6 +88,8 @@ module Types null: true, resolver: ::Resolvers::Ci::RunnerProjectsResolver, description: 'Find projects the runner is associated with. For project runners only.' + 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.' field :run_untagged, GraphQL::Types::Boolean, null: false, @@ -141,12 +147,14 @@ module Types Gitlab::Routing.url_helpers.edit_admin_runner_url(runner) if can_admin_runners? end - def ephemeral_authentication_token - return unless runner.authenticated_user_registration_type? - return unless runner.created_at > RUNNER_EPHEMERAL_TOKEN_AVAILABILITY_TIME.ago - return if runner.runner_machines.any? + def register_admin_url + return unless can_admin_runners? && runner.registration_available? - runner.token + Gitlab::Routing.url_helpers.register_admin_runner_url(runner) + end + + def ephemeral_authentication_token + runner.token if runner.registration_available? end def project_count |