diff --git a/app/models/concerns/has_status.rb b/app/models/concerns/has_status.rb index dff7b6e352383caa95be819e11a3dac7e13277e1..3c9c6584e026ea7ecb8b7fd6c8277a8e2e92e505 100644 --- a/app/models/concerns/has_status.rb +++ b/app/models/concerns/has_status.rb @@ -82,7 +82,7 @@ module HasStatus scope :failed_or_canceled, -> { where(status: [:failed, :canceled]) } scope :cancelable, -> do - where(status: [:running, :pending, :created, :manual]) + where(status: [:running, :pending, :created]) end end diff --git a/changelogs/unreleased/fix-gb-exclude-manual-actions-from-cancelable-jobs.yml b/changelogs/unreleased/fix-gb-exclude-manual-actions-from-cancelable-jobs.yml new file mode 100644 index 0000000000000000000000000000000000000000..a16fc775b5e3039ea1a691373e21e46d193173fd --- /dev/null +++ b/changelogs/unreleased/fix-gb-exclude-manual-actions-from-cancelable-jobs.yml @@ -0,0 +1,4 @@ +--- +title: Exclude manual actions when checking if pipeline can be canceled +merge_request: 11562 +author: diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index 157d17fbb6814cb3448c06eefef814ea43200711..56b24ce62f3a724677e2c4c036f05e77e6a5434a 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -854,6 +854,16 @@ describe Ci::Pipeline, models: true do end end end + + context 'when there is a manual action present in the pipeline' do + before do + create(:ci_build, :manual, pipeline: pipeline) + end + + it 'is not cancelable' do + expect(pipeline).not_to be_cancelable + end + end end describe '#cancel_running' do