Коммит 01c02ac0 создал по автору Marius Bobin's avatar Marius Bobin Зафиксировано автором Douglas Barbosa Alexandre
Просмотр файлов

Add pipeline ID and URL for downstream variables

Allows bridge jobs to expand variables that use
CI_PIPELINE_ID and CI_PIPELINE_URL
владелец d8058520
......@@ -130,7 +130,9 @@ def dependent?
end
def downstream_variables
scoped_variables.to_runner_variables.yield_self do |all_variables|
variables = scoped_variables.concat(pipeline.persisted_variables)
variables.to_runner_variables.yield_self do |all_variables|
yaml_variables.to_a.map do |hash|
{ key: hash[:key], value: ::ExpandVariables.expand(hash[:value], all_variables) }
end
......
---
title: Pass pipeline variables when expanding Bridge downstream variables.
merge_request: 18875
author:
type: fixed
......@@ -225,13 +225,40 @@
end
context 'when using variables interpolation' do
let(:yaml_variables) do
[
{
key: 'EXPANDED',
value: '$BRIDGE-bridge',
public: true
},
{
key: 'UPSTREAM_CI_PIPELINE_ID',
value: '$CI_PIPELINE_ID',
public: true
},
{
key: 'UPSTREAM_CI_PIPELINE_URL',
value: '$CI_PIPELINE_URL',
public: true
}
]
end
before do
bridge.yaml_variables << { key: 'EXPANDED', value: '$BRIDGE-bridge', public: true }
bridge.yaml_variables.concat(yaml_variables)
end
it 'correctly expands variables with interpolation' do
expanded_values = pipeline
.persisted_variables
.to_hash
.transform_keys { |key| "UPSTREAM_#{key}" }
.map { |key, value| { key: key, value: value } }
.push(key: 'EXPANDED', value: 'cross-bridge')
expect(bridge.downstream_variables)
.to include(key: 'EXPANDED', value: 'cross-bridge')
.to match(a_collection_including(*expanded_values))
end
end
......
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать