summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Provaznik <jprovaznik@gitlab.com>2018-06-22 22:03:48 +0200
committerJan Provaznik <jprovaznik@gitlab.com>2018-06-22 22:25:17 +0200
commit8cbdf4f56fc3d49bccc1353cc94daf8d033b6134 (patch)
treeb398668aac530a7f12ba82bfbf8b00dc8b6ec12d
parentec93b3fb4b049ba166bcaf5e6c5593a45b793fdf (diff)
downloadgitlab-ce-rails5-enum-pipeline-check.tar.gz
Added Project#auto_cancel_pending_pipelines? methodrails5-enum-pipeline-check
-rw-r--r--app/models/project.rb4
-rw-r--r--app/services/ci/create_pipeline_service.rb2
2 files changed, 5 insertions, 1 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 0d777515536..d91d7dcfe9a 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -2019,6 +2019,10 @@ class Project < ActiveRecord::Base
end
request_cache(:any_lfs_file_locks?) { self.id }
+ def auto_cancel_pending_pipelines?
+ auto_cancel_pending_pipelines == 'enabled'
+ end
+
private
def storage
diff --git a/app/services/ci/create_pipeline_service.rb b/app/services/ci/create_pipeline_service.rb
index 612bb9dd625..17a53b6a8fd 100644
--- a/app/services/ci/create_pipeline_service.rb
+++ b/app/services/ci/create_pipeline_service.rb
@@ -35,7 +35,7 @@ module Ci
schedule_head_pipeline_update
if sequence.complete?
- cancel_pending_pipelines if project.auto_cancel_pending_pipelines == 'enabled'
+ cancel_pending_pipelines if project.auto_cancel_pending_pipelines?
pipeline_created_counter.increment(source: source)
pipeline.process!