提交 f3e92fb4 编写于 作者: G Grzegorz Bizon 提交者: Grzegorz Bizon

Make CI build eraseable only if build is completed

上级 c8102d93
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册