Add latest changes from gitlab-org/security/gitlab@15-6-stable-ee

This commit is contained in:
GitLab Bot 2022-11-30 11:59:16 +00:00
parent e6572d41b8
commit 8249158901
2 changed files with 16 additions and 2 deletions

View File

@ -28,7 +28,9 @@ module Gitlab
name = @command.yaml_processor_result.workflow_name
name = ExpandVariables.expand(name, -> { global_context.variables.sort_and_expand_all })
pipeline.build_pipeline_metadata(project: pipeline.project, name: name)
return if name.blank?
pipeline.build_pipeline_metadata(project: pipeline.project, name: name.strip)
end
def global_context

View File

@ -89,6 +89,18 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::PopulateMetadata do
expect(pipeline.pipeline_metadata).to be_nil
end
context 'with empty name after variable substitution' do
let(:config) do
{ workflow: { name: '$VAR1' }, rspec: { script: 'rspec' } }
end
it 'does not save empty name' do
run_chain
expect(pipeline.pipeline_metadata).to be_nil
end
end
end
context 'with variables' do
@ -106,7 +118,7 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::PopulateMetadata do
it 'substitutes variables' do
run_chain
expect(pipeline.pipeline_metadata.name).to eq('Pipeline value value1 value2 ')
expect(pipeline.pipeline_metadata.name).to eq('Pipeline value value1 value2')
end
end