morningman opened a new pull request, #66766:
URL: https://github.com/apache/doris/pull/66766

   ### What problem does this PR solve?
   
   Issue Number: N/A
   
   Related PR: #65488, #66663
   
   Problem Summary:
   
   Three improvements to `04-release-complete.sh`, found while preparing 
4.0.8-rc02.
   
   **1. The script could only ever run once**
   
   The first thing it did after checking the RC artifacts was:
   
   ```bash
   if svn info "$RELEASE_SVN_DIR" >/dev/null 2>&1; then
     die "release SVN folder already exists: $RELEASE_SVN_DIR (use --mail-only 
to regenerate the email)"
   fi
   ```
   
   So once the release was published, every re-run died — including a re-run 
right after the publish succeeded and the announce step failed, which is 
exactly when the RM wants to continue. `--mail-only` was the documented 
workaround, but it also skips the checks that would tell the RM whether the 
publish actually completed.
   
   It now discovers the dev and release SVN state first and converges from 
there:
   
   - all three release artifacts present: skip the publish steps, remove a dev 
RC folder that was left behind, draft the email;
   - nothing published: run the full flow, reusing a release directory that 
exists but is empty instead of trying to create it again;
   - some but not all release artifacts present: report exactly which files are 
missing and stop, rather than guessing. `svnmucc` commits all of its operations 
in one revision, so this state can only come from a manual change and deserves 
a human.
   
   The dev RC folder removal is also skipped when the folder is already gone, 
so the `svnmucc rm` cannot fail a re-run.
   
   **2. Every step now asks before it runs**
   
   There used to be exactly one confirmation, right before the `svnmucc` 
commit. Each step now prints what it is about to do and waits:
   
   ```
   == step 3: Publish to the release SVN and remove the dev RC folder ==
        This is public and requires PMC permission.
        All of it lands in one SVN revision:
        mkdir https://dist.apache.org/repos/dist/release/doris/4.0/4.0.8
        mv    .../dev/doris/4.0.8-rc02/apache-doris-4.0.8-rc02-src.tar.gz
          ->  .../release/doris/4.0/4.0.8/apache-doris-4.0.8-src.tar.gz
        ...
   Proceed with step 3? [y/N]
   ```
   
   Declining any step stops the run without changing further state and says so, 
and because the script is idempotent the run can simply be started again later.
   
   **3. The announce draft carries its subject**
   
   `announce-email.txt` now starts with a `Subject:` line matching the header 
already written into `announce-email.eml`, so the subject and the body can be 
copied from one file. This mirrors what #66663 does for the vote email.
   
   **Bonus: a directory leak the existing test already caught**
   
   `tests/test-release-complete-checksum.sh` fails on current master:
   
   ```
   checksum temp directory was not removed after checksum verification failure: 
/var/folders/.../checksum-dir-32602-11908
   ```
   
   `checksum_dir` was `local` to `publish_to_release_svn`, while the `trap ... 
EXIT` referencing it is global. When `set -e` aborted the run the local was 
already out of scope, so the trap expanded it to an empty string and `rm -rf 
""` left the directory behind. It is a script-level variable with a cleanup 
function now, and the test passes.
   
   ### Release note
   
   None
   
   ### Check List (For Author)
   
   - Test
       - [x] Unit Test
   
         `tools/release-tools/tests/test-release-complete-idempotent.sh` (new) 
drives the script with a fake `svn`/`svnmucc` over an already-published release 
and asserts three things:
   
         - dev RC folder already gone: no SVN operation runs at all, the run 
reports the artifacts as already published, and the announce draft is still 
written with its `Subject:` line;
         - stale dev RC folder present: the only `svnmucc` operation is the 
`rm` of that folder — no `mkdir`, `mv` or `put`;
         - a declined step: nothing runs, the run names the step it stopped 
before, and it does not fall through to the later steps.
   
         `tools/release-tools/tests/test-release-complete-checksum.sh` 
(updated) feeds one `y` per step. It covers the leak fix and passed unchanged 
in every other respect.
   
         `./tests/run.sh` is fully green on this branch; 
`test-release-complete-checksum.sh` is red on master.
   
   - Behavior changed:
       - [x] Yes.
   
         Only for the RM running this script. A re-run over a published release 
no longer aborts, each step asks for confirmation instead of only the SVN 
commit, and `announce-email.txt` gains a leading `Subject:` line. No product 
code is touched.
   
   - Does this need documentation?
       - [x] No. `tools/release-tools/README.md` is updated in this PR.
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label
   
   🤖 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