diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 14:34:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 14:34:42 +0000 |
commit | 9f46488805e86b1bc341ea1620b866016c2ce5ed (patch) | |
tree | f9748c7e287041e37d6da49e0a29c9511dc34768 /app/models/ci/processable.rb | |
parent | dfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff) | |
download | gitlab-ce-9f46488805e86b1bc341ea1620b866016c2ce5ed.tar.gz |
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'app/models/ci/processable.rb')
-rw-r--r-- | app/models/ci/processable.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/app/models/ci/processable.rb b/app/models/ci/processable.rb index c123bd7c33b..cc00500662d 100644 --- a/app/models/ci/processable.rb +++ b/app/models/ci/processable.rb @@ -49,7 +49,7 @@ module Ci end validates :type, presence: true - validates :scheduling_type, presence: true, on: :create, if: :validate_scheduling_type? + validates :scheduling_type, presence: true, on: :create, unless: :importing? delegate :merge_request?, :merge_request_ref?, @@ -83,7 +83,7 @@ module Ci # Overriding scheduling_type enum's method for nil `scheduling_type`s def scheduling_type_dag? - super || find_legacy_scheduling_type == :dag + scheduling_type.nil? ? find_legacy_scheduling_type == :dag : super end # scheduling_type column of previous builds/bridges have not been populated, @@ -100,10 +100,12 @@ module Ci end end - private + def ensure_scheduling_type! + # If this has a scheduling_type, it means all processables in the pipeline already have. + return if scheduling_type - def validate_scheduling_type? - !importing? && Feature.enabled?(:validate_scheduling_type_of_processables, project) + pipeline.ensure_scheduling_type! + reset end end end |