summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2017-05-21 10:00:59 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2017-05-21 10:00:59 +0000
commitfe1a814bc6b34496b792fbcce852c8035ec436b5 (patch)
tree5e5ecb84fce04a3fa212884ef44a6e91b222c0da
parentf5f99c9037e52392ca388b6e839d93df88421c31 (diff)
parentf71a9de14d118fb14666df9f78365779308312e1 (diff)
downloadgitlab-ce-fe1a814bc6b34496b792fbcce852c8035ec436b5.tar.gz
Merge branch 'fix/gb/exclude-manual-actions-from-cancelable-jobs' into 'master'
Exclude manual actions when checking if pipeline can be canceled Closes #31107 See merge request !11562
-rw-r--r--app/models/concerns/has_status.rb2
-rw-r--r--changelogs/unreleased/fix-gb-exclude-manual-actions-from-cancelable-jobs.yml4
-rw-r--r--spec/models/ci/pipeline_spec.rb10
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