diff options
author | Tomasz Maczukin <tomasz@maczukin.pl> | 2016-04-21 13:18:35 +0300 |
---|---|---|
committer | Tomasz Maczukin <tomasz@maczukin.pl> | 2016-04-22 23:08:34 +0300 |
commit | 8dd27b47eaa566806ae44a01f963718449f59d8d (patch) | |
tree | 4e384cc07f7697ca345c237c20a9f9e9fbd47fee /lib | |
parent | 80893cad672361e62c0c05c2cf9262209bc54fd2 (diff) |
Add posibility to define a hidden job without 'script' in .gitlab-ci.yml
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ci/gitlab_ci_yaml_processor.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/ci/gitlab_ci_yaml_processor.rb b/lib/ci/gitlab_ci_yaml_processor.rb index ff9887cba1e..4319d99d520 100644 --- a/lib/ci/gitlab_ci_yaml_processor.rb +++ b/lib/ci/gitlab_ci_yaml_processor.rb @@ -63,9 +63,8 @@ module Ci @cache = @config[:cache] @config.except!(*ALLOWED_YAML_KEYS) - # anything that doesn't have script is considered as unknown @config.each do |name, param| - raise ValidationError, "Unknown parameter: #{name}" unless param.is_a?(Hash) && param.has_key?(:script) + raise ValidationError, "Unknown parameter: #{name}" unless is_a_job?(name, param) end unless @config.values.any?{|job| job.is_a?(Hash)} @@ -80,6 +79,12 @@ module Ci end end + def is_a_job?(name, value) + return true if value.is_a?(Hash) && value.has_key?(:script) + return true if name.to_s.start_with?('.') + false + end + def build_job(name, job) { stage_idx: stages.index(job[:stage]), @@ -112,8 +117,6 @@ module Ci true end - private - def validate_global! unless validate_array_of_strings(@before_script) raise ValidationError, "before_script should be an array of strings" |