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!

What does this MR do?

This aims to remove fix some of the cases that could allow Ci::Builds to have both a live trace & and archived trace.

What is changing?

The code change here allows an archived_trace that is incomplete to be removed, and rebuilt in a single run of Ci::Trace#unsafe_archive!. Previously, we would remove the archived_trace and raise an AlreadyArchivedError without rebuilding the archive file.

Scenario Previous New
trace_artifact exists, with file trace chunks removed, AlreadyArchivedError raised Same as previous
trace_artifact exists, no file trace_artifact destroyed, AlreadyArchivedError raised trace_artifact destroyed, archive process runs
trace_artifact does not exist archive process runs Same as previous

In what scenarios does this help?

Ci::ArchiveTracesCronWorker

  1. Archive fails
  2. The worker will retry.
  3. Ci::ArchiveTraceService will be able to remove the old archive and attempt to create a new one in the same run.

Previous behaviour:

  1. Archive fails
  2. The worker will retry.
  3. Ci::ArchiveTraceService will remove the archive, and raise AlreadyArchivedError which the Ci::ArchiveTraceService treats as success.
  4. Will not be retried until Ci::ArchiveTracesCronWorker runs again (every 17 mins)

Screenshots or Screencasts (strongly suggested)

How to setup and validate locally (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Related to #296616 (closed)

Edited by Sean Arnold

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Grzegorz Bizon requested review from @mbobin

    requested review from @mbobin

  • Marius Bobin
  • Marius Bobin
  • Marius Bobin
  • Sean Arnold added 1 commit

    added 1 commit

    • f5ff6d81 - Simply logic in unsafe_archive!

    Compare with previous version

  • Grzegorz Bizon removed review request for @grzesiek

    removed review request for @grzesiek

  • Sean Arnold added 532 commits

    added 532 commits

    • f5ff6d81...a149b49d - 528 commits from branch master
    • 4e4e98ac - Retry archive if left in incomplete state
    • b291faa2 - Scope builds by live trace, not no archived trace
    • 1d2c9d17 - Simply logic in unsafe_archive!
    • bb124a2f - Conditional to determine scope in archive worker

    Compare with previous version

  • Marius Bobin
  • Marius Bobin removed review request for @mbobin

    removed review request for @mbobin

  • Sean Arnold added 1 commit

    added 1 commit

    • 366c39b9 - Rename method, remove change to worker scope

    Compare with previous version

  • Sean Arnold changed the description

    changed the description

  • Sean Arnold requested review from @mbobin

    requested review from @mbobin

  • Marius Bobin approved this merge request

    approved this merge request

  • Marius Bobin removed review request for @mbobin

    removed review request for @mbobin

  • Marius Bobin
  • :wave: @mbobin, thanks for approving this merge request.

    This is the first time the merge request is approved. To ensure full test coverage, a new pipeline has been started.

    For more info, please refer to the following links:

  • Sean Arnold added 1 commit

    added 1 commit

    Compare with previous version

  • Sean Arnold requested review from @smcgivern

    requested review from @smcgivern

  • Sean Arnold marked the checklist item I have included changelog trailers, or none are needed. (Does this MR need a changelog?) as completed

    marked the checklist item I have included changelog trailers, or none are needed. (Does this MR need a changelog?) as completed

  • Sean Arnold marked the checklist item I have added/updated documentation, or it's not needed. (Is documentation required?) as completed

    marked the checklist item I have added/updated documentation, or it's not needed. (Is documentation required?) as completed

  • Sean Arnold marked the checklist item I have properly separated EE content from FOSS, or this MR is FOSS only. (Where should EE code go?) as completed

    marked the checklist item I have properly separated EE content from FOSS, or this MR is FOSS only. (Where should EE code go?) as completed

  • marked the checklist item I have added information for database reviewers in the MR description, or it's not needed. (Does this MR have database related changes?) as completed

  • Sean Arnold marked the checklist item This MR does not harm performance, or I have asked a reviewer to help assess the performance impact. (Merge request performance guidelines) as completed

    marked the checklist item This MR does not harm performance, or I have asked a reviewer to help assess the performance impact. (Merge request performance guidelines) as completed

  • Sean Arnold marked the checklist item I have self-reviewed this MR per code review guidelines. as completed

    marked the checklist item I have self-reviewed this MR per code review guidelines. as completed

  • Sean Arnold marked the checklist item I have followed the style guides. as completed

    marked the checklist item I have followed the style guides. as completed

  • Sean Arnold marked the checklist item This change is backwards compatible across updates, or this does not apply. as completed

    marked the checklist item This change is backwards compatible across updates, or this does not apply. as completed

  • Sean McGivern
  • Sean McGivern approved this merge request

    approved this merge request

  • Sean McGivern requested review from @grzesiek and removed review request for @smcgivern

    requested review from @grzesiek and removed review request for @smcgivern

  • Grzegorz Bizon
  • Grzegorz Bizon removed review request for @grzesiek

    removed review request for @grzesiek

  • Sean Arnold changed the description

    changed the description

  • Sean Arnold added 1 commit

    added 1 commit

    • 644773dc - Revert comment changes above destroy

    Compare with previous version

  • Sean Arnold requested review from @grzesiek

    requested review from @grzesiek

  • Sean Arnold added 1309 commits

    added 1309 commits

    • 644773dc...fa457780 - 1302 commits from branch master
    • 8deb1c70 - Retry archive if left in incomplete state
    • a85209d6 - Scope builds by live trace, not no archived trace
    • 99d5668c - Simply logic in unsafe_archive!
    • dda6ed2b - Conditional to determine scope in archive worker
    • 35b1c1a5 - Rename method, remove change to worker scope
    • 93b92dbf - Remove safe method call
    • bc509e2f - Revert comment changes above destroy

    Compare with previous version

  • Grzegorz Bizon approved this merge request

    approved this merge request

  • Grzegorz Bizon resolved all threads

    resolved all threads

  • So it seems that we do not raise an exception when a trace artifact database entry exists, but a corresponding object in object storage has not been found.

    It means that we can retry this operation immediately after we remove the tracking entry since it seems that it has ben erroneously created.

    We are doing that in the write lock, so it looks good to me! MWPS set!

  • Grzegorz Bizon enabled an automatic merge when the pipeline for 0f211117 succeeds

    enabled an automatic merge when the pipeline for 0f211117 succeeds

  • Grzegorz Bizon mentioned in commit 19043952

    mentioned in commit 19043952

  • added workflowcanary label and removed workflowstaging label

  • added workflowproduction label and removed workflowcanary label

  • Please register or sign in to reply
    Loading