Commit 8a40743e authored by Alan (Maciej) Paruszewski's avatar Alan (Maciej) Paruszewski Committed by Luke Duncalfe

Fix problem with running scheduled policies when variables are empty

parent 06d96858
......@@ -49,14 +49,14 @@ module Security
def child_pipeline_configuration(template, ci_variables)
{
variables: ci_variables.compact,
variables: ci_variables.compact.presence,
inherit: {
variables: false
},
trigger: {
include: [{ template: "#{SCAN_TEMPLATES[template.to_s]}.gitlab-ci.yml" }]
}
}
}.compact
end
def error_script(error_message)
......
......@@ -129,6 +129,19 @@ RSpec.describe Security::SecurityOrchestrationPolicies::CiConfigurationService d
expect(subject).to eq(expected_configuration)
end
context 'when variables are empty' do
let_it_be(:ci_variables) { {} }
it 'returns prepared CI configuration for SAST' do
expected_configuration = {
inherit: { variables: false },
trigger: { include: [{ template: 'Security/SAST.gitlab-ci.yml' }] }
}
expect(subject).to eq(expected_configuration)
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