Commit 66416af8 authored by rossfuhrman's avatar rossfuhrman

Avoid writing empty stage variable

Avoid writing the stage variable if an empty string is passed in
parent 0a429cee
...@@ -36,7 +36,7 @@ module Security ...@@ -36,7 +36,7 @@ module Security
end end
def sast_stage def sast_stage
@params['stage'] || 'test' @params['stage'].presence ? @params['stage'] : 'test'
end end
# We only want to write variables that are set # We only want to write variables that are set
......
...@@ -6,8 +6,12 @@ RSpec.describe Security::CiConfiguration::SastBuildActions do ...@@ -6,8 +6,12 @@ RSpec.describe Security::CiConfiguration::SastBuildActions do
context 'autodevops disabled' do context 'autodevops disabled' do
let(:auto_devops_enabled) { false } let(:auto_devops_enabled) { false }
context 'with one empty parameter' do context 'with empty parameters' do
let(:params) { { 'SECURE_ANALYZERS_PREFIX' => '' } } let(:params) do
{ 'stage' => '',
'SECURE_ANALYZERS_PREFIX' => '',
'SEARCH_MAX_DEPTH' => '' }
end
subject(:result) { described_class.new(auto_devops_enabled, params).generate } subject(:result) { described_class.new(auto_devops_enabled, params).generate }
......
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