diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-07-08 11:29:03 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-07-08 11:29:03 +0200 |
commit | 159aed1c4220277ece9b4496d460f931cd65e228 (patch) | |
tree | 8ed870c82d7f76b765860829985db3888763d5fc | |
parent | 8baee987beaea8197d28ee9715ef23f5813566e5 (diff) | |
download | gitlab-ce-159aed1c4220277ece9b4496d460f931cd65e228.tar.gz |
Extract global CI config entry configuration setup
-rw-r--r-- | lib/gitlab/ci/config/node/global.rb | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/gitlab/ci/config/node/global.rb b/lib/gitlab/ci/config/node/global.rb index dffa3326630..110d982588b 100644 --- a/lib/gitlab/ci/config/node/global.rb +++ b/lib/gitlab/ci/config/node/global.rb @@ -39,21 +39,24 @@ module Gitlab helpers :before_script, :image, :services, :after_script, :variables, :stages, :types, :cache, :jobs - def initialize(config) - return super unless config.is_a?(Hash) - - jobs = config.except(*nodes.keys) - global = config.slice(*nodes.keys) - - super(global.merge(jobs: jobs)) + def initialize(config, **attributes) + super(setup(config), attributes) + @global = self end def stages stages_defined? ? stages_value : types_value end - def global - self + private + + 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 |