holdenk opened a new pull request, #60472:
URL: https://github.com/apache/spark/pull/60472

   [SPARK-61665][BUILD] Let backports in the merge script open a draft PR for CI
   
   ### What changes were proposed in this pull request?
   
   Every backport pick in `dev/merge_spark_pr.py` now asks how to land, instead 
of `Push to apache? (y/N)`:
   
   - `[d]` push directly to `apache/<branch>` (the old behaviour);
   - `[p]` force-push the pick to `backport-pr<N>-<branch>` on your fork and 
open a **draft** PR against `<branch>`, so CI runs before the backport merges;
   - `[s]` skip this branch (the default).
   
   The `[p]` path:
   
   - **Settings.** It uses `FORK_REMOTE_NAME` (default `origin`) and 
`GITHUB_OAUTH_KEY`. `FORK_OWNER` is needed only when the fork URL uses an SSH 
host alias.
   - **Fork check.** The fork is checked by the repository its URL names, not 
by remote name. A fork remote that resolves to `apache/spark`, or to the 
push/PR remote, is refused before anything is pushed.
   - **Failures.** If the fork can't be used or the push fails, nothing is 
pushed and the pick is kept: you get instructions to open the PR by hand, a 
prompt to paste its URL, and then the landing prompt again. If the push works 
but the PR doesn't open, you get the compare link and the same paste prompt.
   - **Retries.** A retry updates the same fork branch, and the title and body 
of its open PR.
   - **Title.** The PR title carries the target branch as a version tag 
(`[SPARK-1234][4.2][SQL] ...`), so the merge script still accepts it.
   - **Body.** The PR body is `Backport-of: #<N>` followed by the pick's commit 
message. When that PR (head `backport-pr<N>-<branch>`) is later merged with 
this script, `merge_pr` keeps the original message, its `Closes #<N>` footer 
and its original author. It skips the `Closes #<backport>` / `Authored-by: 
<committer>` it would otherwise add, and only appends `Backport-PR: 
#<backport>`, `Co-authored-by` for anyone who pushed fixups to the backport PR, 
and the committer's sign-off. So `dev/pr_merge_status.py <N>` and the 
already-backported scan still see the branch, and the contributor stays the 
author.
   
   **Landed vs. pending.**
   
   - A branch with only a draft backport PR counts as pending, not landed. JIRA 
fix versions come only from landed branches.
   - The merge comment shows a PR link instead of a commit link for a pending 
branch.
   - **Upstream-First:** if `branch-M.x` is only pending, it is not picked 
again. A direct push of `branch-M.N` then needs an explicit maintenance-only 
confirmation; this holds inside the `[b]oth` path too.
   - Backport PRs from an earlier run also count as pending. These are found 
with `git ls-remote` for `backport-pr<N>-*` on the fork, then confirmed to 
still have an open PR, since a closed PR's branch often lingers.
   
   ### Why are the changes needed?
   
   Draft backport PRs let a backport get full CI before it lands, and carrying 
the original message and author through keeps the contributor credited and the 
merge status tooling accurate. Builds on the optional pre-push checks from 
SPARK-59791.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. Committer-facing dev tool only.
   
   ### How was this patch tested?
   
   `python3 -m doctest dev/merge_spark_pr.py` (also with `FORK_OWNER`, 
`FORK_REMOTE_NAME`, `PUSH_REMOTE_NAME` and `PR_REMOTE_NAME` set, since the 
doctests pin those), `ruff check` and `ruff format`. New doctests cover every 
`[p]` outcome, the fork check across URL shapes, the backport title, 
`Backport-of` detection and message carry-through, Upstream-First with a 
pending branch, and earlier-run detection. Used to merge 
https://github.com/apache/spark/pull/58901 and 
https://github.com/apache/spark/pull/57873.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code
   
   
   Stacked on the SPARK-59791 pre-push checks PR (its commit is the first in 
this branch); this supersedes the backport-PR half of #59899.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to