From 159aed1c4220277ece9b4496d460f931cd65e228 Mon Sep 17 00:00:00 2001
From: Grzegorz Bizon <grzesiek.bizon@gmail.com>
Date: Fri, 8 Jul 2016 11:29:03 +0200
Subject: [PATCH] Extract global CI config entry configuration setup

---
 lib/gitlab/ci/config/node/global.rb | 21 ++++++++++++---------
 1 file 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
-- 
GitLab