debian-mirror-gitlab/app/graphql/mutations/ci/pipeline_cancel.rb
2020-11-24 15:15:51 +05:30

22 lines
459 B
Ruby

# 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