Repository navigation
Phase 2 (C): delete partial archive on build failure - #41
Merged
Merged
Conversation
Member
Author
|
Sonnet /review-pr: no high-confidence issues across all six scrutiny points (exit-code capture, $KEY scope, Deferred (not a false positive, out of scope for this workflow-only diff): if the runner is killed mid-stream before CompleteMultipartUpload, the streaming script may leave an incomplete multipart upload that |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 2 (C) of epic nemarOrg/nemar-cli#736. Make a failed archive build stop being "sticky": the streaming script finalizes whatever it appended and completes the multipart upload before it exits non-zero on an incomplete build, so a failed run leaves a partial zip at the canonical key
nemar/<id>/archives/v<X>.zip. Combined with the idempotency skip-if-exists guard, that partial turned every subsequent dispatch into a no-op until a human passedforce=true(exactly what happened to nm000111).This change deletes the canonical object on any non-zero exit of the streaming script, so a re-dispatch rebuilds cleanly.
Change (one step)
In "Stream archive to S3", wrap
node /tmp/stream-archive.js, capture its exit code, and on non-zero exitaws s3 rm s3://nemar/<KEY>(tolerating a missing object) before propagating the failure.Why delete-on-failure (vs temp-key-and-promote)
The normal publish path is already protected by the skip-if-exists guard, so it never overwrites a good archive. Only an explicit
force=truerebuild can reach the delete with a prior good object present, and that is a deliberate recovery action. This avoids a server-side multipart copy for archives larger than 5 GB.Closes nemarOrg/nemar-cli#739
Part of epic nemarOrg/nemar-cli#736
Test plan (real dispatches, no mocks)
On the disposable test dataset nm099999 (branch workflow via
--ref):/annex/objects/SHA256E-s999--...to a non-existent S3 object), tagged it, and dispatched. The build skipped that blob (1 annexed + 8 regular + 1 skipped), exited 1, and the step loggedremoving any partial ...thendelete: s3://nemar/nm099999/archives/v1.0.1.zip. After the run,archives/v1.0.1.zipis absent (anonymous HEAD -> 403) -- the partial did not linger.0 skipped, succeeded, andarchives/v1.0.0.zipremains present (200) -- delete-on-failure does not fire on success.Note observed during testing (not a regression): creating a version tag fires the production
version-doi -> generate-archiverepository_dispatchpath onmain, which lacks this change, so it can re-create the partial if it races a manualforcerun for the same version. Once this merges tomain, both paths delete-on-failure. Test artifacts (tags + fixture file) were cleaned up.