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
2f3b2820
Commit
2f3b2820
authored
Oct 01, 2021
by
Marius Bobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create trace artifact and update metadata inside a database transaction
parent
bbf08ffe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
app/services/ci/archive_build_trace_service.rb
app/services/ci/archive_build_trace_service.rb
+9
-5
No files found.
app/services/ci/archive_build_trace_service.rb
View file @
2f3b2820
...
@@ -14,9 +14,13 @@ module Ci
...
@@ -14,9 +14,13 @@ module Ci
def
execute!
(
stream
)
def
execute!
(
stream
)
clone_file!
(
stream
,
JobArtifactUploader
.
workhorse_upload_path
)
do
|
clone_path
|
clone_file!
(
stream
,
JobArtifactUploader
.
workhorse_upload_path
)
do
|
clone_path
|
md5_checksum
=
self
.
class
.
md5_hexdigest
(
clone_path
)
md5_checksum
=
self
.
class
.
md5_hexdigest
(
clone_path
)
trace_artifact
=
create_build_trace!
(
job
,
clone_path
)
sha256_checksum
=
self
.
class
.
sha256_hexdigest
(
clone_path
)
trace_metadata
.
track_archival!
(
trace_artifact
.
id
,
md5_checksum
)
job
.
transaction
do
trace_artifact
=
create_build_trace!
(
clone_path
,
sha256_checksum
)
trace_metadata
.
track_archival!
(
trace_artifact
.
id
,
md5_checksum
)
end
end
end
end
end
...
@@ -34,7 +38,7 @@ module Ci
...
@@ -34,7 +38,7 @@ module Ci
end
end
end
end
def
create_build_trace!
(
job
,
path
)
def
create_build_trace!
(
path
,
file_sha256
)
File
.
open
(
path
)
do
|
stream
|
File
.
open
(
path
)
do
|
stream
|
# TODO: Set `file_format: :raw` after we've cleaned up legacy traces migration
# TODO: Set `file_format: :raw` after we've cleaned up legacy traces migration
# https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/20307
# https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/20307
...
@@ -42,7 +46,7 @@ module Ci
...
@@ -42,7 +46,7 @@ module Ci
project:
job
.
project
,
project:
job
.
project
,
file_type: :trace
,
file_type: :trace
,
file:
stream
,
file:
stream
,
file_sha256:
self
.
class
.
sha256_hexdigest
(
path
)
)
file_sha256:
file_sha256
)
end
end
end
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