Commit e9b42067 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Remove CI job stage code from legacy config processor

parent 9edced40
...@@ -57,6 +57,9 @@ module Ci ...@@ -57,6 +57,9 @@ module Ci
private private
def initial_parsing def initial_parsing
##
# Global config
#
@before_script = @ci_config.before_script @before_script = @ci_config.before_script
@image = @ci_config.image @image = @ci_config.image
@after_script = @ci_config.after_script @after_script = @ci_config.after_script
...@@ -65,24 +68,16 @@ module Ci ...@@ -65,24 +68,16 @@ module Ci
@stages = @ci_config.stages @stages = @ci_config.stages
@cache = @ci_config.cache @cache = @ci_config.cache
@jobs = {} ##
# Jobs
@ci_config.jobs.each do |name, param| #
add_job(name, param) @jobs = @ci_config.jobs
end
@jobs.each do |name, job| @jobs.each do |name, job|
validate_job!(name, job) validate_job!(name, job)
end end
end end
def add_job(name, job)
raise ValidationError, "Unknown parameter: #{name}" unless job.is_a?(Hash) && job.has_key?(:script)
stage = job[:stage] || job[:type] || DEFAULT_STAGE
@jobs[name] = { stage: stage }.merge(job)
end
def build_job(name, job) def build_job(name, job)
{ {
stage_idx: @stages.index(job[:stage]), stage_idx: @stages.index(job[:stage]),
...@@ -112,12 +107,13 @@ module Ci ...@@ -112,12 +107,13 @@ module Ci
end end
def validate_job!(name, job) def validate_job!(name, job)
raise ValidationError, "Unknown parameter: #{name}" unless job.is_a?(Hash) && job.has_key?(:script)
validate_job_name!(name) validate_job_name!(name)
validate_job_keys!(name, job) validate_job_keys!(name, job)
validate_job_types!(name, job) validate_job_types!(name, job)
validate_job_script!(name, job) validate_job_script!(name, job)
validate_job_stage!(name, job) if job[:stage]
validate_job_variables!(name, job) if job[:variables] validate_job_variables!(name, job) if job[:variables]
validate_job_cache!(name, job) if job[:cache] validate_job_cache!(name, job) if job[:cache]
validate_job_artifacts!(name, job) if job[:artifacts] validate_job_artifacts!(name, job) if job[:artifacts]
...@@ -186,12 +182,6 @@ module Ci ...@@ -186,12 +182,6 @@ module Ci
end end
end end
def validate_job_stage!(name, job)
unless job[:stage].is_a?(String) && job[:stage].in?(@stages)
raise ValidationError, "#{name} job: stage parameter should be #{@stages.join(", ")}"
end
end
def validate_job_variables!(name, job) def validate_job_variables!(name, job)
unless validate_variables(job[:variables]) unless validate_variables(job[:variables])
raise ValidationError, raise ValidationError,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment