Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
fb7cc53653
commit
f29c140c1c
|
@ -27,7 +27,7 @@ module Gitlab
|
|||
|
||||
override :_resolve
|
||||
def _resolve(resolver)
|
||||
object = resolver.config.dig(*location)
|
||||
object = config_at_location(resolver)
|
||||
value = resolver.deep_resolve(object)
|
||||
|
||||
raise MissingReferenceError, missing_ref_error_message unless value
|
||||
|
@ -35,6 +35,12 @@ module Gitlab
|
|||
value
|
||||
end
|
||||
|
||||
def config_at_location(resolver)
|
||||
resolver.config.dig(*location)
|
||||
rescue TypeError
|
||||
raise MissingReferenceError, missing_ref_error_message
|
||||
end
|
||||
|
||||
def missing_ref_error_message
|
||||
"#{data[:tag]} #{data[:seq].inspect} could not be found"
|
||||
end
|
||||
|
|
|
@ -69,6 +69,23 @@ RSpec.describe Gitlab::Ci::Config::Yaml::Tags::Reference do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when the references are valid but do not match the config' do
|
||||
let(:yaml) do
|
||||
<<~YML
|
||||
a: [1, 2]
|
||||
b: [3, 4]
|
||||
c: !reference [a, b]
|
||||
YML
|
||||
end
|
||||
|
||||
it 'raises a MissingReferenceError' do
|
||||
expect { subject }.to raise_error(
|
||||
Gitlab::Ci::Config::Yaml::Tags::Reference::MissingReferenceError,
|
||||
'!reference ["a", "b"] could not be found'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with arrays' do
|
||||
let(:yaml) do
|
||||
<<~YML
|
||||
|
|
Loading…
Reference in New Issue