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

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

36 lines
897 B
Ruby
Raw Normal View History

2021-09-04 01:27:46 +05:30
# frozen_string_literal: true
module Mutations
module Ci
module Runner
class Delete < BaseMutation
graphql_name 'RunnerDelete'
authorize :delete_runner
RunnerID = ::Types::GlobalIDType[::Ci::Runner]
argument :id, RunnerID,
required: true,
description: 'ID of the runner to delete.'
def resolve(id:, **runner_attrs)
runner = authorized_find!(id)
2022-05-07 20:08:51 +05:30
::Ci::Runners::UnregisterRunnerService.new(runner, current_user).execute
2021-09-04 01:27:46 +05:30
{ errors: runner.errors.full_messages }
end
def find_object(id)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = RunnerID.coerce_isolated_input(id)
GitlabSchema.find_by_gid(id)
end
end
end
end
end