diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-05-19 20:42:05 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-05-19 20:45:49 +0200 |
commit | f71a9de14d118fb14666df9f78365779308312e1 (patch) | |
tree | 0afe2ec00dc22fe5eff9c24b25becb16fef9c980 | |
parent | bdf62a19d2cdbdfe554eb73500fd5fe4744161b1 (diff) | |
download | gitlab-ce-fix/gb/exclude-manual-actions-from-cancelable-jobs.tar.gz |
Exclude manual actions from cancelable jobs scopefix/gb/exclude-manual-actions-from-cancelable-jobs
-rw-r--r-- | app/models/concerns/has_status.rb | 2 | ||||
-rw-r--r-- | changelogs/unreleased/fix-gb-exclude-manual-actions-from-cancelable-jobs.yml | 4 | ||||
-rw-r--r-- | spec/models/ci/pipeline_spec.rb | 10 |
3 files changed, 15 insertions, 1 deletions
diff --git a/app/models/concerns/has_status.rb b/app/models/concerns/has_status.rb index dff7b6e3523..3c9c6584e02 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 00000000000..a16fc775b5e --- /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 157d17fbb68..56b24ce62f3 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 |