Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-10-12 15:09:36 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-10-12 15:09:36 +0300
commit57a3a42c88f6e7dbcfd388a5c83302f0bb666023 (patch)
treef9b3368c0f0bb66deeabccc40dedc4066ff0ee22 /lib/gitlab/ci/trace.rb
parent91e8c3a6efea1d805cfa86e7ade9a9628344cf89 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/ci/trace.rb')
-rw-r--r--lib/gitlab/ci/trace.rb16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/gitlab/ci/trace.rb b/lib/gitlab/ci/trace.rb
index c8f19d65c9e..25075cc8f90 100644
--- a/lib/gitlab/ci/trace.rb
+++ b/lib/gitlab/ci/trace.rb
@@ -25,7 +25,7 @@ module Gitlab
delegate :old_trace, to: :job
delegate :can_attempt_archival_now?, :increment_archival_attempts!,
- :archival_attempts_message, to: :trace_metadata
+ :archival_attempts_message, :archival_attempts_available?, to: :trace_metadata
def initialize(job)
@job = job
@@ -122,6 +122,10 @@ module Gitlab
end
end
+ def attempt_archive_cleanup!
+ destroy_any_orphan_trace_data!
+ end
+
def update_interval
if being_watched?
UPDATE_FREQUENCY_WHEN_BEING_WATCHED
@@ -191,7 +195,10 @@ module Gitlab
def unsafe_archive!
raise ArchiveError, 'Job is not finished yet' unless job.complete?
- unsafe_trace_conditionally_cleanup_before_retry!
+ already_archived?.tap do |archived|
+ destroy_any_orphan_trace_data!
+ raise AlreadyArchivedError, 'Could not archive again' if archived
+ end
if job.trace_chunks.any?
Gitlab::Ci::Trace::ChunkedIO.new(job) do |stream|
@@ -214,16 +221,15 @@ module Gitlab
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?
+ trace_artifact&.archived_trace_exists?
end
- def unsafe_trace_conditionally_cleanup_before_retry!
+ def destroy_any_orphan_trace_data!
return unless trace_artifact
if already_archived?
# An archive already exists, so make sure to remove the trace chunks
erase_trace_chunks!
- raise AlreadyArchivedError, 'Could not archive again'
else
# An archive already exists, but its associated file does not, so remove it
trace_artifact.destroy!