Make CI build eraseable only if build is completed
This commit is contained in:
parent
c8102d938b
commit
f3e92fb4d0
3 changed files with 7 additions and 3 deletions
|
@ -205,6 +205,10 @@ module Ci
|
|||
end
|
||||
end
|
||||
|
||||
def trace_empty?
|
||||
raw_trace.blank?
|
||||
end
|
||||
|
||||
def raw_trace
|
||||
if File.file?(path_to_trace)
|
||||
File.read(path_to_trace)
|
||||
|
|
|
@ -11,7 +11,7 @@ module Ci
|
|||
end
|
||||
|
||||
def eraseable?
|
||||
artifacts_file.exists? || File.file?(path_to_trace)
|
||||
complete? && (artifacts_file.exists? || !trace_empty?)
|
||||
end
|
||||
|
||||
def erase_url
|
||||
|
|
|
@ -20,7 +20,7 @@ describe Ci::Build::Eraseable, models: true do
|
|||
end
|
||||
|
||||
context 'build is eraseable' do
|
||||
let!(:build) { create(:ci_build_with_trace, :artifacts) }
|
||||
let!(:build) { create(:ci_build_with_trace, :success, :artifacts) }
|
||||
|
||||
describe '#erase!' do
|
||||
before { build.erase! }
|
||||
|
@ -49,7 +49,7 @@ describe Ci::Build::Eraseable, models: true do
|
|||
end
|
||||
|
||||
context 'metadata and build trace are not available' do
|
||||
let!(:build) { create(:ci_build, :artifacts) }
|
||||
let!(:build) { create(:ci_build, :success, :artifacts) }
|
||||
before { build.remove_artifacts_metadata! }
|
||||
|
||||
describe '#erase!' do
|
||||
|
|
Loading…
Reference in a new issue