summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-03-12 15:07:05 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-03-12 15:07:05 +0100
commitb94db067b7d748418cdf27a49e49c1bf175b7dc8 (patch)
tree9b48cd4aff5717b52b9a920a055f235cd85e13e7 /lib
parent5ed8286e742597720d48e3bf6fc56938ba717f5e (diff)
downloadgitlab-ce-b94db067b7d748418cdf27a49e49c1bf175b7dc8.tar.gz
Use variables collection as build predefined variables
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/ci/variables/collection.rb6
-rw-r--r--lib/gitlab/ci/variables/collection/item.rb4
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/gitlab/ci/variables/collection.rb b/lib/gitlab/ci/variables/collection.rb
index 83db5492d43..ae7415fcdb1 100644
--- a/lib/gitlab/ci/variables/collection.rb
+++ b/lib/gitlab/ci/variables/collection.rb
@@ -7,13 +7,17 @@ module Gitlab
def initialize(variables = [])
@variables = []
- variables.each { |variable| append(variable) }
+ variables.each { |variable| self.append(variable) }
end
def append(resource)
@variables.append(Collection::Item.fabricate(resource))
end
+ def concat(resources)
+ resources.each { |variable| self.append(variable) }
+ end
+
def each
@variables.each { |variable| yield variable }
end
diff --git a/lib/gitlab/ci/variables/collection/item.rb b/lib/gitlab/ci/variables/collection/item.rb
index 4de96e97417..c238ac8f18e 100644
--- a/lib/gitlab/ci/variables/collection/item.rb
+++ b/lib/gitlab/ci/variables/collection/item.rb
@@ -33,10 +33,12 @@ module Gitlab
self.new(resource)
when ::Ci::Variable
self.new(resource.to_hash)
+ when ::Ci::PipelineVariable
+ self.new(resource.to_hash)
when self
resource.dup
else
- raise ArgumentError, 'Unknown CI/CD variable resource!'
+ raise ArgumentError, "Unknown `#{resource.class}` variable resource!"
end
end
end