Commit 9d4c9272 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Document runner's expecations regarding variable collection

parent a194b198
...@@ -27,10 +27,15 @@ module Gitlab ...@@ -27,10 +27,15 @@ module Gitlab
end end
end end
##
# If `file: true` has been provided we expose it, otherwise we
# don't expose `file` attribute at all (stems from what the runner
# expects).
#
def to_runner_variables def to_runner_variables
self.map do |variable| self.map do |variable|
variable.to_h.reject do |key, value| variable.to_h.reject do |component, value|
key == :file && value == false component == :file && value == false
end end
end end
end end
...@@ -40,10 +45,10 @@ module Gitlab ...@@ -40,10 +45,10 @@ module Gitlab
def fabricate(resource) def fabricate(resource)
case resource case resource
when Hash when Hash
Variable.new(resource.fetch(:key), Collection::Variable.new(resource.fetch(:key),
resource.fetch(:value), resource.fetch(:value),
resource.fetch(:public, false), resource.fetch(:public, false),
resource.fetch(:file, false)) resource.fetch(:file, false))
when ::Ci::Variable when ::Ci::Variable
Variable.new(resource.key, resource.value, false, false) Variable.new(resource.key, resource.value, false, false)
when Collection::Variable when Collection::Variable
......
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