Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
8deb1c70
Commit
8deb1c70
authored
Aug 25, 2021
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Retry archive if left in incomplete state
Changelog: changed
parent
fa457780
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
6 deletions
+18
-6
lib/gitlab/ci/trace.rb
lib/gitlab/ci/trace.rb
+9
-3
spec/services/ci/archive_trace_service_spec.rb
spec/services/ci/archive_trace_service_spec.rb
+9
-3
No files found.
lib/gitlab/ci/trace.rb
View file @
8deb1c70
...
...
@@ -194,7 +194,7 @@ module Gitlab
if
trace_artifact
unsafe_trace_cleanup!
raise
AlreadyArchivedError
,
'Could not archive again'
raise
AlreadyArchivedError
,
'Could not archive again'
if
already_archived?
end
if
job
.
trace_chunks
.
any?
...
...
@@ -215,14 +215,20 @@ module Gitlab
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!
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
erase_trace_chunks!
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!
end
end
...
...
spec/services/ci/archive_trace_service_spec.rb
View file @
8deb1c70
...
...
@@ -28,7 +28,7 @@ RSpec.describe Ci::ArchiveTraceService, '#execute' do
context
'when live trace chunks still exist'
do
before
do
create
(
:ci_build_trace_chunk
,
build:
job
)
create
(
:ci_build_trace_chunk
,
build:
job
,
chunk_index:
0
)
end
it
'removes the trace chunks'
do
...
...
@@ -40,8 +40,14 @@ RSpec.describe Ci::ArchiveTraceService, '#execute' do
job
.
job_artifacts_trace
.
file
.
remove!
end
it
'removes the trace artifact'
do
expect
{
subject
}.
to
change
{
job
.
reload
.
job_artifacts_trace
}.
to
(
nil
)
it
'removes the trace artifact and builds a new one'
do
existing_trace
=
job
.
job_artifacts_trace
expect
(
existing_trace
).
to
receive
(
:destroy!
).
and_call_original
subject
expect
(
job
.
reload
.
job_artifacts_trace
).
to
be_present
expect
(
job
.
reload
.
job_artifacts_trace
.
file
.
file
).
to
be_present
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment