summaryrefslogtreecommitdiff
path: root/lib/ci/gitlab_ci_yaml_processor.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ci/gitlab_ci_yaml_processor.rb')
-rw-r--r--lib/ci/gitlab_ci_yaml_processor.rb11
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 ddf34b60a85..b8ede3a7edc 100644
--- a/lib/ci/gitlab_ci_yaml_processor.rb
+++ b/lib/ci/gitlab_ci_yaml_processor.rb
@@ -45,7 +45,10 @@ module Ci
end
def job_variables(name)
- @jobs[name.to_sym].try(:fetch, :variables, []) || []
+ job = @jobs[name.to_sym]
+ return [] unless job
+
+ job.fetch(:variables, [])
end
private
@@ -123,7 +126,7 @@ module Ci
end
unless @variables.nil? || validate_variables(@variables)
- raise ValidationError, "variables should be a map of key-valued strings"
+ raise ValidationError, "variables should be a map of key-value strings"
end
if @cache
@@ -216,9 +219,9 @@ module Ci
end
def validate_job_variables!(name, job)
- if job[:variables] && !validate_variables(job[:variables])
+ unless validate_variables(job[:variables])
raise ValidationError,
- "#{name} job: variables should be a map of key-valued strings"
+ "#{name} job: variables should be a map of key-value strings"
end
end