summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-07-12 12:56:21 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-07-12 12:56:21 +0200
commit8c9c3eda7a305c43d7cf3d50b868292d0b612b5b (patch)
treecaca9c2aa5eddb8b20e81b68654e3db259b8c862
parent80587064eb798f5bf2b18dbb8e65e5a55d1db085 (diff)
downloadgitlab-ce-8c9c3eda7a305c43d7cf3d50b868292d0b612b5b.tar.gz
Prevalidate CI entries recursively on processed
-rw-r--r--lib/gitlab/ci/config/node/entry.rb5
-rw-r--r--spec/lib/ci/gitlab_ci_yaml_processor_spec.rb2
2 files changed, 3 insertions, 4 deletions
diff --git a/lib/gitlab/ci/config/node/entry.rb b/lib/gitlab/ci/config/node/entry.rb
index 1940c39087b..02e4f7693da 100644
--- a/lib/gitlab/ci/config/node/entry.rb
+++ b/lib/gitlab/ci/config/node/entry.rb
@@ -31,10 +31,9 @@ module Gitlab
end
def validate!
- if @validator.valid?(:new)
- @validator.validate(:processed)
- end
+ return unless valid?
+ @validator.validate(:processed)
@entries.each_value(&:validate!)
end
diff --git a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
index a80b0ce5a57..1017f79cc6e 100644
--- a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
+++ b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
@@ -1065,7 +1065,7 @@ EOT
end
it "returns errors if there are no visible jobs defined" do
- config = YAML.dump({ before_script: ["bundle update"], '.hidden'.to_sym => {} })
+ config = YAML.dump({ before_script: ["bundle update"], '.hidden'.to_sym => { script: 'ls' } })
expect do
GitlabCiYamlProcessor.new(config, path)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "jobs config should contain at least one visible job")