diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-04-17 20:23:42 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-04-18 13:17:48 +0200 |
commit | 2b1c08be8fa5c18f1fe151feb2a0938734086481 (patch) | |
tree | 0fda2e8e739fed60fe9e8c587a7ebf41ceb4c9d2 /lib | |
parent | a2957291b3a28eff3988dfc8bdcff4b99b20a1b3 (diff) | |
download | gitlab-ce-2b1c08be8fa5c18f1fe151feb2a0938734086481.tar.gz |
Validate job-level variables in YAML config file
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ci/gitlab_ci_yaml_processor.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/ci/gitlab_ci_yaml_processor.rb b/lib/ci/gitlab_ci_yaml_processor.rb index 209da7ad81f..ddf34b60a85 100644 --- a/lib/ci/gitlab_ci_yaml_processor.rb +++ b/lib/ci/gitlab_ci_yaml_processor.rb @@ -153,6 +153,7 @@ module Ci validate_job_types!(name, job) validate_job_stage!(name, job) if job[:stage] + validate_job_variables!(name, job) if job[:variables] validate_job_cache!(name, job) if job[:cache] validate_job_artifacts!(name, job) if job[:artifacts] validate_job_dependencies!(name, job) if job[:dependencies] @@ -214,6 +215,13 @@ module Ci end end + def validate_job_variables!(name, job) + if job[:variables] && !validate_variables(job[:variables]) + raise ValidationError, + "#{name} job: variables should be a map of key-valued strings" + end + end + def validate_job_cache!(name, job) if job[:cache][:key] && !validate_string(job[:cache][:key]) raise ValidationError, "#{name} job: cache:key parameter should be a string" |