diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-03-12 11:43:24 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-03-12 11:43:24 +0100 |
commit | 9d4c9272e016442cd84fbada82493b03b350bb8e (patch) | |
tree | 1da842d09a562423c316e7396266a8ef8432ae59 /lib | |
parent | a194b1982426b5f2411ee4a62ac3432de293528b (diff) | |
download | gitlab-ce-9d4c9272e016442cd84fbada82493b03b350bb8e.tar.gz |
Document runner's expecations regarding variable collection
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/ci/variables/collection.rb | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/gitlab/ci/variables/collection.rb b/lib/gitlab/ci/variables/collection.rb index e9aa7f9a31c..2f5987f2846 100644 --- a/lib/gitlab/ci/variables/collection.rb +++ b/lib/gitlab/ci/variables/collection.rb @@ -27,10 +27,15 @@ module Gitlab 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 self.map do |variable| - variable.to_h.reject do |key, value| - key == :file && value == false + variable.to_h.reject do |component, value| + component == :file && value == false end end end @@ -40,10 +45,10 @@ module Gitlab def fabricate(resource) case resource when Hash - Variable.new(resource.fetch(:key), - resource.fetch(:value), - resource.fetch(:public, false), - resource.fetch(:file, false)) + Collection::Variable.new(resource.fetch(:key), + resource.fetch(:value), + resource.fetch(:public, false), + resource.fetch(:file, false)) when ::Ci::Variable Variable.new(resource.key, resource.value, false, false) when Collection::Variable |