Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2024-01-04 15:19:41 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2024-01-04 15:19:41 +0300
commitac72b79188a14a28eafe55d32641f9939cf5d9c4 (patch)
treed6f6f349fb30017a600ebdee07b832889615978e /app/models/ci
parent8f89276d8498f45459bca67493eccd1bdf055330 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/ci')
-rw-r--r--app/models/ci/pipeline.rb6
-rw-r--r--app/models/ci/pipeline_metadata.rb2
-rw-r--r--app/models/ci/processable.rb4
3 files changed, 10 insertions, 2 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb
index 97e49c15814..1bf4d585e1c 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -438,7 +438,7 @@ module Ci
where_exists(Ci::Build.latest.scoped_pipeline.with_artifacts(reports_scope))
end
- scope :with_only_interruptible_builds, -> do
+ scope :conservative_interruptible, -> do
where_not_exists(
Ci::Build.scoped_pipeline.with_status(STARTED_STATUSES).not_interruptible
)
@@ -1393,6 +1393,10 @@ module Ci
merge_request.merge_request_diff_for(merge_request_diff_sha)
end
+ def auto_cancel_on_new_commit
+ pipeline_metadata&.auto_cancel_on_new_commit || 'conservative'
+ end
+
private
def add_message(severity, content)
diff --git a/app/models/ci/pipeline_metadata.rb b/app/models/ci/pipeline_metadata.rb
index 37fa3e32ad8..a41cdf61b71 100644
--- a/app/models/ci/pipeline_metadata.rb
+++ b/app/models/ci/pipeline_metadata.rb
@@ -7,7 +7,7 @@ module Ci
enum auto_cancel_on_new_commit: {
conservative: 0,
interruptible: 1,
- disabled: 2
+ none: 2
}, _prefix: true
enum auto_cancel_on_job_failure: {
diff --git a/app/models/ci/processable.rb b/app/models/ci/processable.rb
index 414d36da7c3..989d6337ab7 100644
--- a/app/models/ci/processable.rb
+++ b/app/models/ci/processable.rb
@@ -33,6 +33,10 @@ module Ci
where('NOT EXISTS (?)', needs)
end
+ scope :interruptible, -> do
+ joins(:metadata).merge(Ci::BuildMetadata.with_interruptible)
+ end
+
scope :not_interruptible, -> do
joins(:metadata).where.not(
Ci::BuildMetadata.table_name => { id: Ci::BuildMetadata.scoped_build.with_interruptible.select(:id) }