Refactorize CI::Build model

上级 cc365e98
...@@ -209,7 +209,7 @@ module Ci ...@@ -209,7 +209,7 @@ module Ci
end end
def has_trace_file? def has_trace_file?
File.exist?(path_to_trace) || (project.ci_id && File.exist?(old_path_to_trace)) File.exist?(path_to_trace) || has_old_trace_file?
end end
def has_trace? def has_trace?
...@@ -219,7 +219,7 @@ module Ci ...@@ -219,7 +219,7 @@ module Ci
def raw_trace def raw_trace
if File.file?(path_to_trace) if File.file?(path_to_trace)
File.read(path_to_trace) File.read(path_to_trace)
elsif project.ci_id && File.file?(old_path_to_trace) elsif has_old_trace_file?
# Temporary fix for build trace data integrity # Temporary fix for build trace data integrity
File.read(old_path_to_trace) File.read(old_path_to_trace)
else else
...@@ -228,6 +228,14 @@ module Ci ...@@ -228,6 +228,14 @@ module Ci
end end
end end
##
# Deprecated
#
# This is a hotfix for CI build data integrity, see #4246
def has_old_trace_file?
project.ci_id && File.exist?(old_path_to_trace)
end
def trace def trace
trace = raw_trace trace = raw_trace
if project && trace.present? && project.runners_token.present? if project && trace.present? && project.runners_token.present?
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册