Repository navigation
[2.8] Use S3 conditional writes to prevent overwriting published artifacts - #11599
Conversation
…11532) sbin/upload-artifacts now uploads via `aws s3api put-object --if-none-match "*"` instead of `aws s3 cp`, and the release workflow's copy_object passes IfNoneMatch="*". Both fail loudly if an object already exists at the target key instead of silently overwriting it. upload-artifacts also propagates a rejected upload to the job exit status, which the `{ ...; } || ...` construct swallowed. (cherry picked from commit 046c693)
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 80089683d6
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| try: | ||
| client.copy_object( | ||
| Bucket=bucket, Key=dst, CopySource={"Bucket": bucket, "Key": src}, | ||
| ACL="public-read", IfNoneMatch="*", |
There was a problem hiding this comment.
Use a supported target precondition for CopyObject
When the set-artifacts job promotes any release artifact, Boto3 validates this request locally and CopyObject does not accept IfNoneMatch as an input parameter (its similarly named conditional parameter applies to the copy source). This raises an uncaught ParamValidationError before S3 is called, so every release with artifacts fails instead of promoting them. Use an operation that supports a destination conditional write, or otherwise implement the copy with a supported atomic precondition.
Useful? React with 👍 / 👎.
| # Copy included files to new location | ||
| # IfNoneMatch="*" makes the copy a conditional write: S3 rejects it with PreconditionFailed | ||
| # if an object already exists at dst, instead of silently overwriting a published artifact. | ||
| for src, dst in zip(include_list, dest_files): |
There was a problem hiding this comment.
Make failed release copies safely resumable
If a transient S3 error occurs after an earlier iteration has copied an artifact, this loop exits with those earlier destination objects already publicly visible. Retrying then fails on the first object from the failed attempt because the new precondition rejects it, leaving the release permanently partial unless someone manually removes the published objects. Preflight all destinations and/or verify and accept already-copied identical artifacts on retry so a failed promotion can be completed safely.
Useful? React with 👍 / 👎.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 2.8 #11599 +/- ##
==========================================
- Coverage 87.71% 87.71% -0.01%
==========================================
Files 204 204
Lines 35583 35583
==========================================
- Hits 31212 31210 -2
- Misses 4371 4373 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
|
@AngelYanev this backport had cherry-pick conflicts that the backport agent resolved automatically. Could you please review the conflict resolution (see the conflict log in the PR description), and if everything looks OK, approve it? Auto-merge is enabled, so your approval will queue it for merge. Note: besides porting the conditional write, the agent also changed |



Backport of #11532 to
2.8.Original PR
046c693486a4a3c157a0f685cd299e4c448f98b9Cherry-pick result
Conflict Log
sbin/upload-artifacts.github/workflows/event-release.ymlRelease notes
🤖 Generated by the auto-backport workflow.