Skip to content

Add prepare-patch.sh to backport pending PRs before a patch release - #722

Merged
jbachorik merged 6 commits into
mainfrom
feat/patch_helper
Aug 7, 2026
Merged

Add prepare-patch.sh to backport pending PRs before a patch release#722
jbachorik merged 6 commits into
mainfrom
feat/patch_helper

Conversation

@jbachorik

Copy link
Copy Markdown
Collaborator

What does this PR do?:
Adds utils/prepare-patch.sh, invoked from release.sh's patch-release flow, to let a maintainer interactively pick PRs merged to main since a release branch diverged, cherry-pick the selection onto one combined branch, validate the build (./gradlew buildDebug), and open a single combined backport PR.

Motivation:
Preparing a patch release currently requires manually finding and cherry-picking candidate PRs one at a time with backport-pr.sh. This adds a guided, interactive step to release.sh for patch releases: pick a release branch, pick which pending main PRs to backport, and get one combined PR to review and merge before releasing.

Along the way, this also:

  • Fixes release.sh/prepare-patch.sh interactive pickers crashing with an "unbound variable" error on Ctrl-C (set -u + an interrupted read).
  • Fixes mapfile usage that isn't available under macOS's stock bash 3.2.
  • Fixes branch/commit lookups failing with "unknown revision" for release branches that have no local ref.
  • Adds an explicit check that the selected release branch is up to date with origin before proceeding.

Additional Notes:
Both interactive pickers (release branch, commit, PR multi-select) support arrow-key navigation and can be cancelled at any time with q or Ctrl-C.

How to test the change?:

  • bash -n utils/release.sh utils/prepare-patch.sh and shellcheck pass cleanly.
  • Ran utils/release.sh --help and utils/prepare-patch.sh --help under /bin/bash (macOS stock bash 3.2) to confirm no mapfile crash.
  • Exercised the interactive pickers manually, including cancelling with Ctrl-C and q, and confirmed no crash.
  • utils/prepare-patch.sh defaults to dry-run; verified the dry-run summary against a real release branch/PR set without pushing or opening a PR.

For Datadog employees:

  • If this PR touches code that signs or publishes builds or packages, or handles
    credentials of any kind, I've requested a security review (run the dd:platform-security-review
    skill, or file a request via the PSEC review form).
    bewaire also runs automatically on every PR.
  • This PR doesn't touch any of that.
  • JIRA: [JIRA-XXXX]

Unsure? Have a question? Request a review!

jbachorik and others added 5 commits August 7, 2026 13:02
Lets you multi-select PRs merged to main since a release branch diverged,
cherry-picks them onto one branch, validates the build, and opens a combined
PR. Wired into release.sh's patch flow.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
macOS ships bash 3.2 which lacks the mapfile builtin, breaking these
scripts when run under /bin/bash instead of a newer bash.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds an explicit check that a local branch (if checked out) matches
origin before proceeding, with correct pull guidance instead of the
misleading "push" hint that only fit the ahead-of-origin case.

Also fixes select_commit and the ancestor check to read origin/$BRANCH
directly, since a branch picked via the interactive picker usually has
no local ref of the same name and previously failed with "unknown
revision".

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
read_key() now guards against a failed read under set -u, and both
scripts trap SIGINT to exit cleanly instead of crashing with an
unbound-variable error. Docs updated for the origin-freshness check
and the new cancel behavior.
@jbachorik jbachorik added the AI label Aug 7, 2026
@jbachorik
jbachorik marked this pull request as ready for review August 7, 2026 11:31
@jbachorik
jbachorik requested a review from a team as a code owner August 7, 2026 11:31
@dd-octo-sts

dd-octo-sts Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Scan-Build Report

User:runner@runnervmvrwv9
Working Directory:/home/runner/work/java-profiler/java-profiler/ddprof-lib/src/test/make
Command Line:make -j4 all
Clang Version:Ubuntu clang version 18.1.3 (1ubuntu1)
Date:Fri Aug 7 15:58:53 2026

Bug Summary

Bug TypeQuantityDisplay?
All Bugs1
Logic error
Dereference of null pointer1

Reports

Bug Group Bug Type ▾ File Function/Method Line Path Length
Logic errorDereference of null pointerprofiler.hfindLibraryByAddress51713

@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: 456938669b

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread utils/prepare-patch.sh Outdated
Comment thread utils/prepare-patch.sh Outdated
Comment thread utils/prepare-patch.sh Outdated
Comment thread utils/prepare-patch.sh Outdated
Comment thread utils/prepare-patch.sh Outdated
Comment thread utils/release.sh Outdated
@dd-octo-sts

dd-octo-sts Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

CI Test Results

Run: #31195153567 | Commit: f7359af | Duration: 15m 48s (longest job)

All 32 test jobs passed

Status Overview

JDK glibc-aarch64/debug glibc-amd64/debug musl-aarch64/debug musl-amd64/debug
8 - - -
8-ibm - - -
8-j9 - -
8-librca - -
8-orcl - - -
11 - - -
11-j9 - -
11-librca - -
17 - -
17-graal - -
17-j9 - -
17-librca - -
21 - -
21-graal - -
21-librca - -
25 - -
25-graal - -
25-librca - -

Legend: ✅ passed | ❌ failed | ⚪ skipped | 🚫 cancelled

Summary: Total: 32 | Passed: 32 | Failed: 0


Updated: 2026-08-07 16:15:34 UTC

@dd-octo-sts

dd-octo-sts Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

All 40 integration tests passed

📊 Dashboard · 👷 Pipeline · 📦 d3377cf5

Fix down-arrow arithmetic exiting pickers under set -e, empty
confirmations backporting PR #0, prep branch inheriting stale local
commits, already-backported PRs reappearing as candidates, merge-commit
cherry-picks failing without a mainline, and the backport prompt
hanging without a TTY.
@jbachorik
jbachorik merged commit cc27d72 into main Aug 7, 2026
109 checks passed
@jbachorik
jbachorik deleted the feat/patch_helper branch August 7, 2026 16:45
@github-actions github-actions Bot added this to the 1.49.0 milestone Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant