Skip to content

[2.8] Use S3 conditional writes to prevent overwriting published artifacts - #11599

Merged
redisearch-backport-pull-request[bot] merged 1 commit into
2.8from
backport-agent/pr-11532-to-2.8
Sep 30, 2026
Merged

redisearch-backport-pull-request[bot] merged 1 commit into
2.8from
backport-agent/pr-11532-to-2.8

Conversation

@redisearch-backport-pull-request

Copy link
Copy Markdown
Contributor

Backport of #11532 to 2.8.

Original PR

Cherry-pick result

  • Resolved 2 conflict(s) — see Conflict Log below.

Conflict Log

sbin/upload-artifacts

  • Conflict: The source hunk updates error handling in a beta-upload loop, while the release branch ends its upload function after the snapshot loop.
  • Why it conflicted: 2.8 does not contain the beta-directory upload feature present in the source parent; its upload function retains the original completion message.
  • Resolution: Kept the release branch upload flow and completion message, omitted the absent beta loop, and retained the conditional put-object operation, snapshot failure propagation, temporary-file cleanup on upload failure, and explicit upload_product exit-status handling.
  • Rationale: Applies overwrite protection and propagates rejected uploads for the existing release upload path without introducing the unrelated beta-upload feature. Builds and tests were not run, as requested; CI must validate AWS CLI and SDK compatibility.

.github/workflows/event-release.yml

  • Conflict: The release workflow imports ast at the location where the source patch adds the ClientError import.
  • Why it conflicted: 2.8 still parses platform lists with ast.literal_eval, whereas the source parent has removed that import.
  • Resolution: Retained import ast and added from botocore.exceptions import ClientError; kept the source conditional copy and exception handling.
  • Rationale: Preserves platform-list parsing while supplying the exception type needed by the new overwrite-rejection handling.

Release notes

  • This PR requires release notes
  • This PR does not require release notes

🤖 Generated by the auto-backport workflow.

…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)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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="*",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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

codecov Bot commented Sep 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.71%. Comparing base (65b5c64) to head (8008968).

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     
Flag Coverage Δ
flow 82.07% <ø> (-0.22%) ⬇️
unit 42.77% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sonarqubecloud

Copy link
Copy Markdown

@alonre24

Copy link
Copy Markdown
Collaborator

@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 upload_product to propagate the upload exit status — on this branch the { ...; } || { ... } wrapper disabled set -e, so a rejected upload would otherwise leave the job green.

@redisearch-backport-pull-request
redisearch-backport-pull-request Bot added this pull request to the merge queue Sep 30, 2026
Merged via the queue into 2.8 with commit 503ce68 Sep 30, 2026
20 checks passed
@redisearch-backport-pull-request
redisearch-backport-pull-request Bot deleted the backport-agent/pr-11532-to-2.8 branch September 30, 2026 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport This PR was automatically backported by an agent auto-backport-conflicts There were conflicts in this automatic backport size:S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants