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')
-rw-r--r--app/graphql/mutations/ci/job/base.rb2
-rw-r--r--app/graphql/mutations/ci/job/cancel.rb28
-rw-r--r--app/graphql/mutations/ci/job/play.rb2
-rw-r--r--app/graphql/mutations/ci/job/retry.rb2
-rw-r--r--app/graphql/mutations/ci/job/unschedule.rb28
5 files changed, 59 insertions, 3 deletions
diff --git a/app/graphql/mutations/ci/job/base.rb b/app/graphql/mutations/ci/job/base.rb
index 3359def159a..a9fe26226d9 100644
--- a/app/graphql/mutations/ci/job/base.rb
+++ b/app/graphql/mutations/ci/job/base.rb
@@ -8,7 +8,7 @@ module Mutations
argument :id, JobID,
required: true,
- description: 'The ID of the job to mutate.'
+ description: 'ID of the job to mutate.'
def find_object(id: )
# TODO: remove this line when the compatibility layer is removed
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
diff --git a/app/graphql/mutations/ci/job/play.rb b/app/graphql/mutations/ci/job/play.rb
index f87904f8b25..99f62ea3e70 100644
--- a/app/graphql/mutations/ci/job/play.rb
+++ b/app/graphql/mutations/ci/job/play.rb
@@ -9,7 +9,7 @@ module Mutations
field :job,
Types::Ci::JobType,
null: true,
- description: 'The job after the mutation.'
+ description: 'Job after the mutation.'
authorize :update_build
diff --git a/app/graphql/mutations/ci/job/retry.rb b/app/graphql/mutations/ci/job/retry.rb
index a61d5dddb40..9af357ab216 100644
--- a/app/graphql/mutations/ci/job/retry.rb
+++ b/app/graphql/mutations/ci/job/retry.rb
@@ -9,7 +9,7 @@ module Mutations
field :job,
Types::Ci::JobType,
null: true,
- description: 'The job after the mutation.'
+ description: 'Job after the mutation.'
authorize :update_build
diff --git a/app/graphql/mutations/ci/job/unschedule.rb b/app/graphql/mutations/ci/job/unschedule.rb
new file mode 100644
index 00000000000..07b1896bd2c
--- /dev/null
+++ b/app/graphql/mutations/ci/job/unschedule.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+module Mutations
+ module Ci
+ module Job
+ class Unschedule < Base
+ graphql_name 'JobUnschedule'
+
+ field :job,
+ Types::Ci::JobType,
+ null: true,
+ description: 'Job after the mutation.'
+
+ authorize :update_build
+
+ def resolve(id:)
+ job = authorized_find!(id: id)
+
+ ::Ci::BuildUnscheduleService.new(job, current_user).execute
+ {
+ job: job,
+ errors: errors_on_object(job)
+ }
+ end
+ end
+ end
+ end
+end