Skip to content

Commit

Permalink
Exit on Coverity scan failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislav Kolotinskiy committed Oct 28, 2021
1 parent 5f10098 commit 76408e8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions lib/travis/build/addons/coverity_scan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ def build_command
env << "COVERITY_SCAN_BUILD_COMMAND_PREPEND=\"${COVERITY_SCAN_BUILD_COMMAND_PREPEND:-#{@config[:build_command_prepend]}}\""
env << "COVERITY_SCAN_BRANCH_PATTERN=${COVERITY_SCAN_BRANCH_PATTERN:-#{@config[:branch_pattern]}}"
sh.cmd "curl -s #{@config[:build_script_url]} | #{env.join(' ')} bash", echo: true
sh.raw 'result=$?', echo: true
sh.if '$result -ne 0', echo: true do
sh.raw "echo -e \"\033[33;1mSkipping build_coverity due to script error\033[0m\""
sh.raw 'exit 1', echo: true
end
end
end
sh.else echo:true do
Expand Down
6 changes: 4 additions & 2 deletions spec/build/addons/coverity_scan_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

describe Travis::Build::Addons::CoverityScan, :sexp do
let(:script) { stub('script') }
let(:config) { {} }
let(:config) { { project: { name: 'test' } } }
let(:data) { payload_for(:push, :ruby, config: { addons: { coverity_scan: config } }) }
let(:sh) { Travis::Shell::Builder.new }
let(:addon) { described_class.new(script, sh, Travis::Build::Data.new(data), config) }
Expand All @@ -13,5 +13,7 @@
# let(:code) { ['CODECLIMATE_REPO_TOKEN=1234'] }
# end

xit 'needs specs!'
it 'returns some lines' do
expect(subject).to be_present
end
end

0 comments on commit 76408e8

Please sign in to comment.