Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/graphql/mutations/ci/job/cancel.rb')
-rw-r--r--app/graphql/mutations/ci/job/cancel.rb28
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