summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrew cimino <dcimino@gitlab.com>2019-07-16 17:59:55 -0400
committerdrew cimino <dcimino@gitlab.com>2019-07-16 18:12:33 -0400
commit01e11c80b7c04d03d8b181201a3d06b419687232 (patch)
tree1d10bce55223ba194524817bdc76717f819c2fd5
parente43cc0926269ef6219c648133db5ebc985fec602 (diff)
downloadgitlab-ce-ci-config-job-rules.tar.gz
fixed custom Config::Entry validationci-config-job-rules
-rw-r--r--lib/gitlab/ci/config/entry/job.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/gitlab/ci/config/entry/job.rb b/lib/gitlab/ci/config/entry/job.rb
index 0c1d2330f38..6c181fb3e5e 100644
--- a/lib/gitlab/ci/config/entry/job.rb
+++ b/lib/gitlab/ci/config/entry/job.rb
@@ -17,6 +17,7 @@ module Gitlab
environment coverage retry parallel extends].freeze
validations do
+ validates :config, type: Hash
validates :config, allowed_keys: ALLOWED_KEYS
validates :config, presence: true
validates :script, presence: true
@@ -25,7 +26,7 @@ module Gitlab
validate :rules_only_except_exclusivity
def rules_only_except_exclusivity
- return unless config.key?(:rules)
+ return unless config.try(:key?, :rules)
errors.add(:config, '`only:` may not be used with `rules:`') if config.key?(:only)
errors.add(:config, '`except:` may not be used with `rules:`') if config.key?(:except)