Skip to content

Fix release script: changelog archiving and master-branch links - #818

Open
wu-sheng wants to merge 2 commits into
mainfrom
fix/release-script-main-branch-links
Open

Fix release script: changelog archiving and master-branch links#818
wu-sheng wants to merge 2 commits into
mainfrom
fix/release-script-main-branch-links

Conversation

@wu-sheng

@wu-sheng wu-sheng commented Aug 6, 2026

Copy link
Copy Markdown
Member

Two fixes to tools/releasing/release.sh, both hit while preparing 9.7.0.

1. Changelog archiving was broken (release-blocking)

The "Move changelog" step of cmd_prepare aborted the release on macOS, after
mvn release:prepare had already created the commits and the tag:

[INFO] Moving changelog to changes/changes-9.7.0.md...
head: illegal line count -- -1

There were two independent bugs in that one block:

a. head -n -1 is GNU-only. "All but the last line" is a GNU coreutils
extension; BSD head on macOS rejects a negative count. Combined with
set -euo pipefail, the release stopped mid-way.

b. The sed range was wrong on every platform.

sed -n "/^${version}$/,/^------------------$/p" CHANGES.md

In CHANGES.md the ------------------ underline sits directly beneath the
version number, so the range closes on the very next line and matches only 2
lines. Even on Linux with GNU head, the archived changes-x.y.z.md would
have been the version number plus the milestone link, with the entire
changelog body silently dropped.

Both are replaced with a single POSIX sed address that keeps everything up to
and including the milestone link and drops only the trailing "Find change logs
of all versions" footer:

sed -n '1,/All issues and pull requests/p' CHANGES.md > "$changes_file"

This reproduces the existing changes/changes-9.6.0.md layout exactly. Also
added: a guard that fails loudly if the milestone line is missing, and a line
count in the log line so a truncated archive is visible in the release output.

2. Email templates linked to a non-existent master branch

The vote and announce templates linked the changelog at
https://github.com/apache/skywalking-java/blob/master/changes/changes-${version}.md.
This repository's default branch is main, so both links 404 for anyone
following the release vote or announcement mail. Two occurrences, in
cmd_email vote and cmd_email announce.

Testing

  • bash -n tools/releasing/release.sh passes.
  • Ran the fixed extraction against the current 9.7.0 CHANGES.md: produces a
    38-line file whose structure diffs clean against changes/changes-9.6.0.md
    (only the changelog bullets and milestone number differ).
  • Swept the script for other GNU-only constructs (sed -i, date -d,
    grep -P, readlink -f, sort -V, …); none found.

🤖 Generated with Claude Code

The vote and announce email templates in tools/releasing/release.sh link
the changelog at blob/master/changes/changes-x.y.z.md, but the default
branch of this repository is main, so those links 404.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@wu-sheng wu-sheng added this to the 9.7.0 milestone Aug 6, 2026
@wu-sheng wu-sheng added the chore label Aug 6, 2026
Two bugs in the "Move changelog" step of cmd_prepare made it fail or
silently produce a near-empty changes/changes-x.y.z.md:

1. `head -n -1` (all but the last line) is a GNU coreutils extension.
   BSD head on macOS rejects a negative count, and with `set -euo pipefail`
   the release aborted right after `mvn release:prepare` had already
   created the commits and the tag:

     [INFO] Moving changelog to changes/changes-9.7.0.md...
     head: illegal line count -- -1

2. The extraction range was wrong on every platform:

     sed -n "/^9.7.0$/,/^------------------$/p" CHANGES.md

   In CHANGES.md the `------------------` underline sits directly beneath
   the version number, so the range closes on the very next line and yields
   only 2 lines. Even with GNU head the archived changelog would have been
   the version number plus the milestone link, with the entire body dropped.

Replace both with a single POSIX sed address that keeps everything up to and
including the milestone link and drops only the trailing "Find change logs of
all versions" footer, which is exactly the existing changes-9.6.0.md layout.
Guard on the milestone line being present, and report the line count so a
truncated archive is visible in the release output.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@wu-sheng wu-sheng changed the title Fix release script email templates linking to non-existent master branch Fix release script: changelog archiving and master-branch links Aug 6, 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.

2 participants