debian-mirror-gitlab/app/graphql/mutations/ci/pipeline/cancel.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

27 lines
534 B
Ruby
Raw Normal View History

2021-03-08 18:12:59 +05:30
# frozen_string_literal: true
module Mutations
module Ci
module Pipeline
class Cancel < Base
graphql_name 'PipelineCancel'
authorize :update_pipeline
def resolve(id:)
pipeline = authorized_find!(id: id)
if pipeline.cancelable?
pipeline.cancel_running
2022-06-21 17:19:12 +05:30
pipeline.cancel
2021-03-08 18:12:59 +05:30
{ success: true, errors: [] }
else
{ success: false, errors: ['Pipeline is not cancelable'] }
end
end
end
end
end
end