Commit a194b198 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Make variables collection to runner mapping explicit

parent a2a8e361
...@@ -115,7 +115,7 @@ class KubernetesService < DeploymentService ...@@ -115,7 +115,7 @@ class KubernetesService < DeploymentService
collection.append(key: 'KUBE_CA_PEM_FILE', value: ca_pem, public: true, file: true) collection.append(key: 'KUBE_CA_PEM_FILE', value: ca_pem, public: true, file: true)
end end
variables.to_hash variables.to_runner_variables
end end
# Constructs a list of terminals from the reactive cache # Constructs a list of terminals from the reactive cache
......
...@@ -27,7 +27,7 @@ module Gitlab ...@@ -27,7 +27,7 @@ module Gitlab
end end
end end
def to_h def to_runner_variables
self.map do |variable| self.map do |variable|
variable.to_h.reject do |key, value| variable.to_h.reject do |key, value|
key == :file && value == false key == :file && value == false
...@@ -35,8 +35,6 @@ module Gitlab ...@@ -35,8 +35,6 @@ module Gitlab
end end
end end
alias_method :to_hash, :to_h
private private
def fabricate(resource) def fabricate(resource)
......
...@@ -52,11 +52,11 @@ describe Gitlab::Ci::Variables::Collection do ...@@ -52,11 +52,11 @@ describe Gitlab::Ci::Variables::Collection do
end end
end end
describe '#to_hash' do describe '#to_runner_variables' do
it 'creates a hash / value mapping' do it 'creates an array of hashes in a runner-compatible format' do
collection = described_class.new([{ key: 'TEST', value: 1 }]) collection = described_class.new([{ key: 'TEST', value: 1 }])
expect(collection.to_hash) expect(collection.to_runner_variables)
.to eq [{ key: 'TEST', value: 1, public: false }] .to eq [{ key: 'TEST', value: 1, public: false }]
end end
end end
......
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