Class: Mutations::Ci::Runner::Update

Inherits:
BaseMutation
  • Object
show all
Includes:
CommonMutationArguments
Defined in:
app/graphql/mutations/ci/runner/update.rb

Constant Summary collapse

RunnerID =
::Types::GlobalIDType[::Ci::Runner]

Constants inherited from BaseMutation

BaseMutation::ERROR_MESSAGE

Constants included from Gitlab::Graphql::Authorize::AuthorizeResource

Gitlab::Graphql::Authorize::AuthorizeResource::ConfigurationError, Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR

Instance Method Summary collapse

Methods inherited from BaseMutation

#api_user?, authorization, authorized?, authorizes_object?, #current_user, #errors_on_object, #load_application_object, #read_only?, #ready?, #unauthorized_object

Methods included from Gitlab::Graphql::Authorize::AuthorizeResource

#authorize!, #authorized_find!, #authorized_resource?, #find_object, #raise_resource_not_available_error!

Instance Method Details

#resolve(id:, **runner_attrs) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'app/graphql/mutations/ci/runner/update.rb', line 34

def resolve(id:, **runner_attrs)
  runner = authorized_find!(id: id)

  associated_projects_ids = runner_attrs.delete(:associated_projects)

  response = { runner: runner, errors: [] }
  ::Ci::Runner.transaction do
    associate_runner_projects(response, runner, associated_projects_ids) unless associated_projects_ids.nil?
    update_runner(response, runner, runner_attrs)
  end

  response
end