Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-07-20 15:15:18 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-07-20 15:15:18 +0300
commitdff10976da42cc729069cddf0f032347fe2f6b14 (patch)
tree403b1f281e0e6196d1ecbd3b76fdabfa7162272b /lib/ci/gitlab_ci_yaml_processor.rb
parentf83bccfe4f98281ed80c95189c5f7ed77799b2b3 (diff)
Move job dependencies entry to the new CI config
Diffstat (limited to 'lib/ci/gitlab_ci_yaml_processor.rb')
-rw-r--r--lib/ci/gitlab_ci_yaml_processor.rb24
1 files changed, 10 insertions, 14 deletions
diff --git a/lib/ci/gitlab_ci_yaml_processor.rb b/lib/ci/gitlab_ci_yaml_processor.rb
index 24601fdfe85..a2e8bd22a52 100644
--- a/lib/ci/gitlab_ci_yaml_processor.rb
+++ b/lib/ci/gitlab_ci_yaml_processor.rb
@@ -98,21 +98,22 @@ module Ci
@jobs = @ci_config.jobs
@jobs.each do |name, job|
- validate_job!(name, job)
+ # logical validation for job
+
+ validate_job_stage!(name, job)
+ validate_job_dependencies!(name, job)
end
end
def yaml_variables(name)
- variables = global_variables.merge(job_variables(name))
+ variables = (@variables || {})
+ .merge(job_variables(name))
+
variables.map do |key, value|
{ key: key, value: value, public: true }
end
end
- def global_variables
- @variables || {}
- end
-
def job_variables(name)
job = @jobs[name.to_sym]
return {} unless job
@@ -120,21 +121,16 @@ module Ci
job[:variables] || {}
end
- def validate_job!(name, job)
- validate_job_stage!(name, job) if job[:stage]
- validate_job_dependencies!(name, job) if job[:dependencies]
- end
-
def validate_job_stage!(name, job)
+ return unless job[:stage]
+
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_dependencies!(name, job)
- unless validate_array_of_strings(job[:dependencies])
- raise ValidationError, "#{name} job: dependencies parameter should be an array of strings"
- end
+ return unless job[:dependencies]
stage_index = @stages.index(job[:stage])