From 9d4c9272e016442cd84fbada82493b03b350bb8e Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Mon, 12 Mar 2018 11:43:24 +0100 Subject: Document runner's expecations regarding variable collection --- lib/gitlab/ci/variables/collection.rb | 17 +++++++++++------ 1 file 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 -- cgit v1.2.1