summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-07-08 11:29:03 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-07-08 11:29:03 +0200
commit159aed1c4220277ece9b4496d460f931cd65e228 (patch)
tree8ed870c82d7f76b765860829985db3888763d5fc
parent8baee987beaea8197d28ee9715ef23f5813566e5 (diff)
downloadgitlab-ce-159aed1c4220277ece9b4496d460f931cd65e228.tar.gz
Extract global CI config entry configuration setup
-rw-r--r--lib/gitlab/ci/config/node/global.rb21
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