diff options
author | Cédric Tabin <tabin.cedric@gmail.com> | 2019-09-05 14:50:39 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2019-09-05 14:50:39 +0000 |
commit | e195e48638dcc56609436e6fcdd9ad3521501798 (patch) | |
tree | f5bef05404ba10a9eeb897f8e9a40725019a8525 /app/services/ci | |
parent | be920a6056b1b2bbc376af43d9aef8df92f090f6 (diff) | |
download | gitlab-ce-e195e48638dcc56609436e6fcdd9ad3521501798.tar.gz |
New interruptible attribute supported in YAML parsing.
Since it is not possible to dynamically detect if a job is automatically
cancellable or not, a this new attribute is necessary. Moreover, it let
the maintainer of the repo to adjust the behaviour of the auto cancellation
feature to match exactly what he needs.
Diffstat (limited to 'app/services/ci')
-rw-r--r-- | app/services/ci/create_pipeline_service.rb | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/app/services/ci/create_pipeline_service.rb b/app/services/ci/create_pipeline_service.rb index 29317f1176e..8f8582afb43 100644 --- a/app/services/ci/create_pipeline_service.rb +++ b/app/services/ci/create_pipeline_service.rb @@ -91,11 +91,21 @@ module Ci # rubocop: disable CodeReuse/ActiveRecord def auto_cancelable_pipelines - project.ci_pipelines - .where(ref: pipeline.ref) - .where.not(id: pipeline.id) - .where.not(sha: project.commit(pipeline.ref).try(:id)) - .created_or_pending + # TODO: Introduced by https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/23464 + if Feature.enabled?(:ci_support_interruptible_pipelines, project, default_enabled: true) + project.ci_pipelines + .where(ref: pipeline.ref) + .where.not(id: pipeline.id) + .where.not(sha: project.commit(pipeline.ref).try(:id)) + .alive_or_scheduled + .without_interruptible_builds + else + project.ci_pipelines + .where(ref: pipeline.ref) + .where.not(id: pipeline.id) + .where.not(sha: project.commit(pipeline.ref).try(:id)) + .created_or_pending + end end # rubocop: enable CodeReuse/ActiveRecord |