summaryrefslogtreecommitdiff
path: root/lib/ci/gitlab_ci_yaml_processor.rb
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-07-18 15:46:24 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-07-18 16:26:38 +0200
commit6d466733a2ab90f2a4d9904e7bfe1ef887568210 (patch)
tree86356a90bcfbb575c4b5bd0ddf88d90e8bf1c5da /lib/ci/gitlab_ci_yaml_processor.rb
parent7cef4f1908d99743bf1dfb9c1cfdd6b2936b2b3d (diff)
downloadgitlab-ce-6d466733a2ab90f2a4d9904e7bfe1ef887568210.tar.gz
Validate allowed keys only in new CI config
Diffstat (limited to 'lib/ci/gitlab_ci_yaml_processor.rb')
-rw-r--r--lib/ci/gitlab_ci_yaml_processor.rb19
1 files changed, 0 insertions, 19 deletions
diff --git a/lib/ci/gitlab_ci_yaml_processor.rb b/lib/ci/gitlab_ci_yaml_processor.rb
index 6901dfbd15d..5c54489ab3f 100644
--- a/lib/ci/gitlab_ci_yaml_processor.rb
+++ b/lib/ci/gitlab_ci_yaml_processor.rb
@@ -4,15 +4,6 @@ module Ci
include Gitlab::Ci::Config::Node::LegacyValidationHelpers
- DEFAULT_STAGE = 'test'
- ALLOWED_YAML_KEYS = [:before_script, :after_script, :image, :services, :types, :stages, :variables, :cache]
- ALLOWED_JOB_KEYS = [:tags, :script, :only, :except, :type, :image, :services,
- :allow_failure, :type, :stage, :when, :artifacts, :cache,
- :dependencies, :before_script, :after_script, :variables,
- :environment]
- ALLOWED_CACHE_KEYS = [:key, :untracked, :paths]
- ALLOWED_ARTIFACTS_KEYS = [:name, :untracked, :paths, :when, :expire_in]
-
attr_reader :path, :cache, :stages
def initialize(config, path = nil)
@@ -102,21 +93,11 @@ module Ci
def validate_job!(name, job)
raise ValidationError, "Unknown parameter: #{name}" unless job.is_a?(Hash) && job.has_key?(:script)
- validate_job_keys!(name, job)
validate_job_types!(name, job)
-
validate_job_stage!(name, job) if job[:stage]
validate_job_dependencies!(name, job) if job[:dependencies]
end
- def validate_job_keys!(name, job)
- job.keys.each do |key|
- unless (ALLOWED_JOB_KEYS + %i[name]).include? key
- raise ValidationError, "#{name} job: unknown parameter #{key}"
- end
- end
- end
-
def validate_job_types!(name, job)
if job[:tags] && !validate_array_of_strings(job[:tags])
raise ValidationError, "#{name} job: tags parameter should be an array of strings"