Skip to content
Snippets Groups Projects

Retry CI trace archive if left in incomplete state

Merged Sean Arnold requested to merge 296616-continue-trace-archive-if-not-complete into master
All threads resolved!
2 files
+ 18
6
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 9
3
@@ -194,7 +194,7 @@ def unsafe_archive!
@@ -194,7 +194,7 @@ def unsafe_archive!
if trace_artifact
if trace_artifact
unsafe_trace_cleanup!
unsafe_trace_cleanup!
raise AlreadyArchivedError, 'Could not archive again'
raise AlreadyArchivedError, 'Could not archive again' if already_archived?
end
end
if job.trace_chunks.any?
if job.trace_chunks.any?
@@ -215,14 +215,20 @@ def unsafe_archive!
@@ -215,14 +215,20 @@ def unsafe_archive!
end
end
end
end
 
def already_archived?
 
# TODO check checksum to ensure archive completed successfully
 
# See https://gitlab.com/gitlab-org/gitlab/-/issues/259619
 
trace_artifact&.archived_trace_exists?
 
end
 
def unsafe_trace_cleanup!
def unsafe_trace_cleanup!
return unless trace_artifact
return unless trace_artifact
if trace_artifact.archived_trace_exists?
if already_archived?
# An archive already exists, so make sure to remove the trace chunks
# An archive already exists, so make sure to remove the trace chunks
erase_trace_chunks!
erase_trace_chunks!
else
else
# An archive already exists, but its associated file does not, so remove it
# An archive already exists, but its associated file is not complete, so remove it
trace_artifact.destroy!
trace_artifact.destroy!
end
end
end
end
Loading