diff options
Diffstat (limited to 'lib/gitlab/ci/config/entry/include/rules')
-rw-r--r-- | lib/gitlab/ci/config/entry/include/rules/rule.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/gitlab/ci/config/entry/include/rules/rule.rb b/lib/gitlab/ci/config/entry/include/rules/rule.rb index 9cdbd8cd037..1a68e95913c 100644 --- a/lib/gitlab/ci/config/entry/include/rules/rule.rb +++ b/lib/gitlab/ci/config/entry/include/rules/rule.rb @@ -14,9 +14,6 @@ module Gitlab attributes :if, :exists, :when - # Include rules are validated before Entry validations. This is because - # the include files are expanded before `compose!` runs in Ci::Config. - # The actual validation logic is in lib/gitlab/ci/config/external/rules.rb. validations do validates :config, presence: true validates :config, type: { with: Hash } @@ -24,8 +21,14 @@ module Gitlab with_options allow_nil: true do validates :if, expression: true + validates :exists, array_of_strings_or_string: true, allow_blank: true + validates :when, allowed_values: { in: ALLOWED_WHEN } end end + + def value + Feature.enabled?(:ci_refactor_external_rules) ? config.compact : super + end end end end |