diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-06 21:11:17 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-06 21:11:17 +0300 |
commit | 183b71521834f47fe2777085ccf001485b546285 (patch) | |
tree | a83a3fd342037dc2365e0d374c34398045868e75 /lib/gitlab/ci/trace.rb | |
parent | 1bb63ff080c33f0a70b5994f2d200dfd72ae1be6 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/ci/trace.rb')
-rw-r--r-- | lib/gitlab/ci/trace.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/gitlab/ci/trace.rb b/lib/gitlab/ci/trace.rb index f9798023838..d4dbf2ac297 100644 --- a/lib/gitlab/ci/trace.rb +++ b/lib/gitlab/ci/trace.rb @@ -4,6 +4,7 @@ module Gitlab module Ci class Trace include ::Gitlab::ExclusiveLeaseHelpers + include ::Gitlab::Utils::StrongMemoize include Checksummable LOCK_TTL = 10.minutes @@ -23,6 +24,8 @@ module Gitlab attr_reader :job delegate :old_trace, to: :job + delegate :can_attempt_archival_now?, :increment_archival_attempts!, + :archival_attempts_message, to: :trace_metadata def initialize(job) @job = job @@ -251,11 +254,19 @@ module Gitlab File.open(path) do |stream| # TODO: Set `file_format: :raw` after we've cleaned up legacy traces migration # https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/20307 - job.create_job_artifacts_trace!( + trace_artifact = job.create_job_artifacts_trace!( project: job.project, file_type: :trace, file: stream, file_sha256: self.class.hexdigest(path)) + + trace_metadata.track_archival!(trace_artifact.id) + end + end + + def trace_metadata + strong_memoize(:trace_metadata) do + job.ensure_trace_metadata! end end |