diff --git a/lib/gitlab/ci/config/node/configurable.rb b/lib/gitlab/ci/config/node/configurable.rb index 7587c8c34c94aa21a1dcf86a38811686d2285b16..d60f87f3f94d5e127932c410600aa2183c89a3bc 100644 --- a/lib/gitlab/ci/config/node/configurable.rb +++ b/lib/gitlab/ci/config/node/configurable.rb @@ -16,20 +16,18 @@ module Gitlab module Configurable extend ActiveSupport::Concern - def initialize(*) - super - - unless @value.is_a?(Hash) - @errors << 'should be a configuration entry with hash value' - end - end - def allowed_nodes self.class.allowed_nodes || {} end private + def prevalidate! + unless @value.is_a?(Hash) + @errors << 'should be a configuration entry with hash value' + end + end + def create_node(key, factory) factory.with(value: @value[key]) factory.nullify! unless @value.has_key?(key) diff --git a/lib/gitlab/ci/config/node/entry.rb b/lib/gitlab/ci/config/node/entry.rb index 507312e0c095753fb87f64c9f84a5ffdcb60a569..52758a962f3c79989cd36582be5dc86114049853 100644 --- a/lib/gitlab/ci/config/node/entry.rb +++ b/lib/gitlab/ci/config/node/entry.rb @@ -14,6 +14,8 @@ module Gitlab @value = value @nodes = {} @errors = [] + + prevalidate! end def process! @@ -56,6 +58,9 @@ module Gitlab private + def prevalidate! + end + def compose! allowed_nodes.each do |key, essence| @nodes[key] = create_node(key, essence)