debian-mirror-gitlab/app/graphql/mutations/ci/runner/update.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

78 lines
2.5 KiB
Ruby
Raw Normal View History

2021-09-04 01:27:46 +05:30
# frozen_string_literal: true
module Mutations
module Ci
module Runner
class Update < BaseMutation
graphql_name 'RunnerUpdate'
authorize :update_runner
RunnerID = ::Types::GlobalIDType[::Ci::Runner]
argument :id, RunnerID,
required: true,
description: 'ID of the runner to update.'
2021-10-27 15:23:28 +05:30
argument :description, GraphQL::Types::String,
2021-09-04 01:27:46 +05:30
required: false,
description: 'Description of the runner.'
2022-07-23 23:45:48 +05:30
argument :maintenance_note, GraphQL::Types::String,
required: false,
description: 'Runner\'s maintenance notes.'
2021-10-27 15:23:28 +05:30
argument :maximum_timeout, GraphQL::Types::Int,
2021-09-04 01:27:46 +05:30
required: false,
description: 'Maximum timeout (in seconds) for jobs processed by the runner.'
argument :access_level, ::Types::Ci::RunnerAccessLevelEnum,
required: false,
description: 'Access level of the runner.'
2021-10-27 15:23:28 +05:30
argument :active, GraphQL::Types::Boolean,
2021-09-04 01:27:46 +05:30
required: false,
2022-04-04 11:22:00 +05:30
description: 'Indicates the runner is allowed to receive jobs.',
deprecated: { reason: :renamed, replacement: 'paused', milestone: '14.8' }
argument :paused, GraphQL::Types::Boolean,
required: false,
description: 'Indicates the runner is not allowed to receive jobs.'
2021-09-04 01:27:46 +05:30
2022-08-27 11:52:29 +05:30
argument :locked, GraphQL::Types::Boolean,
required: false,
description: 'Indicates the runner is locked.'
2021-09-04 01:27:46 +05:30
2021-10-27 15:23:28 +05:30
argument :run_untagged, GraphQL::Types::Boolean,
2021-09-04 01:27:46 +05:30
required: false,
description: 'Indicates the runner is able to run untagged jobs.'
2022-08-27 11:52:29 +05:30
argument :tag_list, [GraphQL::Types::String],
required: false,
description: 'Tags associated with the runner.'
2021-09-04 01:27:46 +05:30
field :runner,
Types::Ci::RunnerType,
null: true,
2021-10-27 15:23:28 +05:30
description: 'Runner after mutation.'
2021-09-04 01:27:46 +05:30
def resolve(id:, **runner_attrs)
runner = authorized_find!(id)
2022-05-07 20:08:51 +05:30
unless ::Ci::Runners::UpdateRunnerService.new(runner).update(runner_attrs)
2021-09-04 01:27:46 +05:30
return { runner: nil, errors: runner.errors.full_messages }
end
{ runner: runner, errors: [] }
end
def find_object(id)
GitlabSchema.find_by_gid(id)
end
end
end
end
end
2021-09-30 23:02:18 +05:30
Mutations::Ci::Runner::Update.prepend_mod_with('Mutations::Ci::Runner::Update')