diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-12 12:14:10 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-12 12:14:10 +0000 |
commit | da646aac6c559584f63d1fc06132d7351abcfac6 (patch) | |
tree | e6e17878b47c081dcd7e161e9bfc3bacd535c8a6 /app/models | |
parent | 612dd7d31ab927dd79968a6be7cb36599291bace (diff) | |
download | gitlab-ce-da646aac6c559584f63d1fc06132d7351abcfac6.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/ci/build.rb | 6 | ||||
-rw-r--r-- | app/models/ci/pipeline.rb | 14 | ||||
-rw-r--r-- | app/models/deployment.rb | 4 |
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 |