From a3c0745514ad98df1fbb8a6142f6cc50df76edae Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Mon, 6 Jun 2016 11:54:54 +0200 Subject: Collect errors from all nodes in new CI config --- lib/gitlab/ci/config/node/entry.rb | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/gitlab/ci/config/node/entry.rb b/lib/gitlab/ci/config/node/entry.rb index 3220b01ca1a..45475316539 100644 --- a/lib/gitlab/ci/config/node/entry.rb +++ b/lib/gitlab/ci/config/node/entry.rb @@ -5,7 +5,7 @@ module Gitlab class Entry include Config::ValidationHelpers - attr_reader :value, :config, :parent, :nodes, :errors + attr_reader :value, :parent def initialize(value, config, parent = nil) @value = value @@ -21,8 +21,20 @@ module Gitlab @nodes[key] = entry.new(@value[key], config, self) end - @nodes.values.each(&:process!) - @nodes.values.each(&:validate!) + nodes.each(&:process!) + nodes.each(&:validate!) + end + + def errors + @errors + nodes.map(&:errors).flatten + end + + def valid? + errors.none? + end + + def nodes + @nodes.values end def keys -- cgit v1.2.1