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

pipeline_cancel.rb « ci « mutations « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bc881e2ac0239de44790d7dfd214101fb29e2caa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

module Mutations
  module Ci
    class PipelineCancel < Base
      graphql_name 'PipelineCancel'

      authorize :update_pipeline

      def resolve(id:)
        pipeline = authorized_find!(id: id)

        if pipeline.cancelable?
          pipeline.cancel_running
          { success: true, errors: [] }
        else
          { success: false, errors: ['Pipeline is not cancelable'] }
        end
      end
    end
  end
end