Commit 159aed1c authored by Grzegorz Bizon's avatar Grzegorz Bizon

Extract global CI config entry configuration setup

parent 8baee987
...@@ -39,21 +39,24 @@ module Gitlab ...@@ -39,21 +39,24 @@ module Gitlab
helpers :before_script, :image, :services, :after_script, helpers :before_script, :image, :services, :after_script,
:variables, :stages, :types, :cache, :jobs :variables, :stages, :types, :cache, :jobs
def initialize(config) def initialize(config, **attributes)
return super unless config.is_a?(Hash) super(setup(config), attributes)
@global = self
jobs = config.except(*nodes.keys)
global = config.slice(*nodes.keys)
super(global.merge(jobs: jobs))
end end
def stages def stages
stages_defined? ? stages_value : types_value stages_defined? ? stages_value : types_value
end end
def global private
self
def setup(config)
return config unless config.is_a?(Hash)
jobs = config.except(*nodes.keys)
global = config.slice(*nodes.keys)
global.merge(jobs: jobs)
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment