summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-01-12 12:14:10 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-01-12 12:14:10 +0000
commitda646aac6c559584f63d1fc06132d7351abcfac6 (patch)
treee6e17878b47c081dcd7e161e9bfc3bacd535c8a6 /app/models
parent612dd7d31ab927dd79968a6be7cb36599291bace (diff)
downloadgitlab-ce-da646aac6c559584f63d1fc06132d7351abcfac6.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
-rw-r--r--app/models/ci/build.rb6
-rw-r--r--app/models/ci/pipeline.rb14
-rw-r--r--app/models/deployment.rb4
3 files changed, 11 insertions, 13 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 5bd2b4371da..fdcb877dcab 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -268,6 +268,10 @@ module Ci
!build.any_unmet_prerequisites? # If false is returned, it stops the transition
end
+ before_transition on: :enqueue do |build|
+ !build.waiting_for_deployment_approval? # If false is returned, it stops the transition
+ end
+
after_transition created: :scheduled do |build|
build.run_after_commit do
Ci::BuildScheduleWorker.perform_at(build.scheduled_at, build.id)
@@ -424,7 +428,7 @@ module Ci
end
def playable?
- action? && !archived? && (manual? || scheduled? || retryable?)
+ action? && !archived? && (manual? || scheduled? || retryable?) && !waiting_for_deployment_approval?
end
def waiting_for_deployment_approval?
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb
index b1568bbbb06..d11304e5285 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -467,15 +467,11 @@ module Ci
end
def tags_count
- if tag_counts_enabled?
- ActsAsTaggableOn::Tagging.where(taggable: builds).count
- end
+ ActsAsTaggableOn::Tagging.where(taggable: builds).count
end
def distinct_tags_count
- if tag_counts_enabled?
- ActsAsTaggableOn::Tagging.where(taggable: builds).count('distinct(tag_id)')
- end
+ ActsAsTaggableOn::Tagging.where(taggable: builds).count('distinct(tag_id)')
end
def stages_names
@@ -1352,12 +1348,6 @@ module Ci
::Gitlab::Ci::PipelineObjectHierarchy
.new(self.class.unscoped.where(id: id), options: options)
end
-
- def tag_counts_enabled?
- strong_memoize(:tag_counts_enabled) do
- ::Feature.enabled?(:ci_pipeline_logger_tags_count, project, default_enabled: :yaml)
- end
- end
end
end
diff --git a/app/models/deployment.rb b/app/models/deployment.rb
index 453c6bce362..2f04d99f9f6 100644
--- a/app/models/deployment.rb
+++ b/app/models/deployment.rb
@@ -70,6 +70,10 @@ class Deployment < ApplicationRecord
transition created: :blocked
end
+ event :unblock do
+ transition blocked: :created
+ end
+
event :succeed do
transition any - [:success] => :success
end