diff options
Diffstat (limited to 'app/graphql/mutations/ci/job/cancel.rb')
-rw-r--r-- | app/graphql/mutations/ci/job/cancel.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/app/graphql/mutations/ci/job/cancel.rb b/app/graphql/mutations/ci/job/cancel.rb new file mode 100644 index 00000000000..dc9f4d19779 --- /dev/null +++ b/app/graphql/mutations/ci/job/cancel.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module Mutations + module Ci + module Job + class Cancel < Base + graphql_name 'JobCancel' + + field :job, + Types::Ci::JobType, + null: true, + description: 'Job after the mutation.' + + authorize :update_build + + def resolve(id:) + job = authorized_find!(id: id) + + ::Ci::BuildCancelService.new(job, current_user).execute + { + job: job, + errors: errors_on_object(job) + } + end + end + end + end +end |