Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/scripts/integration-governance.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const MAX_COMMITS = 1000;
const MAX_AUTHOR_BATCH = 50;
// This literal is inside the enrolled .github closure. A caller-supplied
// preparedBy.sourceSHA must never choose a new executable verifier tree.
const TRUSTED_SCRIPTS_TREE = '68aa6a3ea98f2ab257c8d492b39b8a661092786d';
const TRUSTED_SCRIPTS_TREE = 'af7a0249a3df8e6197ff49031d4cb6c4e00581c6';
const SOURCE = 'https://github.com/kubernetes-sigs/kubebuilder-release-tools/tree/012269a88fa4c034a0acf1ba84c26b195c0dbab4';
const sha = value => crypto.createHash('sha256').update(value).digest('hex');
const git = (args, cwd = process.cwd()) =>
Expand Down
9 changes: 8 additions & 1 deletion changelog.d/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,17 @@ deleting the fragments in the same release commit.
need no fragment only if non-user-visible (routine refactors, dependency churn,
or test-adjacent code like `testdata/` or non-`_test.go` test helpers) — put
a `no-changelog` label on such PRs.
- The `<!-- release: none|major|minor|patch -->` escape hatch
- The `<!-- release: major|minor|patch -->` bump escape hatch
(`src/docs/releases.md`) may ride in a fragment as its first line; it is
compiled into `Unreleased` verbatim and honoured by
`derive-release-version.sh` exactly as a hand-placed marker is.
**`<!-- release: none -->` is rejected in fragments** (by
`check-changelog-fragment.sh` at PR time and `compile-changelog.sh` at
release time): a fragment persists until the release that consumes it, and
`none` is what forbids that release, so a single such fragment freezes
every later merge until a human deletes it — [#12928](https://github.com/hivecommons/hive/pull/12928)
stalled releases for three weeks this way. A non-user-visible change wants
no fragment and the `no-changelog` label instead.

Example — a complete fragment, `changelog.d/fixed-1234-relay-timeout.md`:

Expand Down
2 changes: 0 additions & 2 deletions changelog.d/changed-12923-off-prompt-fixture.md

This file was deleted.

1 change: 1 addition & 0 deletions changelog.d/fixed-release-none-fragment-stall.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Tagged releases resume: a `release: none` HTML-comment marker that rode in a `changelog.d/` fragment (#12928, merged 2026-10-19) was compiled into `## Unreleased` on every merge and made the release workflow's decide job skip every commit since v5.186.4 as an "explicit human override" — the fragment could only be consumed by the very release it vetoed. The fragment is removed; `check-changelog-fragment.sh` and `compile-changelog.sh` now reject a `none` marker in a fragment (bump markers stay allowed); and a hand-placed `none` freeze in CHANGELOG.md is surfaced as a workflow warning annotation and fails the decide job once it has outlived `RELEASE_FREEZE_MAX_DAYS` (default 7) instead of silently skipping forever. Also fixed on the way out: with the resulting 1,369-fragment backlog the bump inference's `grep -q` died of SIGPIPE under `pipefail` and would have labelled the catch-up release a patch instead of the minor its `### Added` section calls for.
15 changes: 14 additions & 1 deletion src/docs/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,20 @@ decision:
```

suppresses a release for this merge even if `Unreleased` has content (the
entries stay queued for the next release that does fire). Or force a specific
entries stay queued for the next release that does fire). Note the
consequence under the fragment model: nothing but a release empties
`Unreleased`, so a `none` marker placed there (by hand, in `CHANGELOG.md`)
is a **release freeze** that lasts until a human removes it, not a one-merge
skip — the decide job emits a `::warning::` annotation on every run while it
is in force, and fails outright once the newest tag is older than
`RELEASE_FREEZE_MAX_DAYS` (default 7; `0` disables) so a forgotten freeze
turns red instead of looking like a healthy no-op. For the same reason the marker is **rejected in a
`changelog.d/` fragment** by `check-changelog-fragment.sh` and
`compile-changelog.sh`: a fragment lives until the release that consumes it,
so a `none` fragment can never be consumed and vetoes every later merge
(#12928 stalled v5 releases from 2026-10-19 to 2026-11-07 this way). A
change that should not be mentioned wants no fragment and the
`no-changelog` label. Or force a specific
bump regardless of which headers are present:

```markdown
Expand Down
11 changes: 10 additions & 1 deletion src/scripts/check-changelog-fragment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,19 @@ while IFS= read -r f; do
case "$first_line" in
'- '*|'<!-- release:'*|'<!--release:'*) ;;
*)
echo "::error file=$f::a fragment must start with a '- ' entry bullet (or a '<!-- release: ... -->' marker) — it IS the entry; the compiler owns the ### headings"
echo "::error file=$f::a fragment must start with a '- ' entry bullet (or a '<!-- release: major|minor|patch -->' marker) — it IS the entry; the compiler owns the ### headings"
bad=1
;;
esac
# A fragment persists until the next release consumes it, and a
# `<!-- release: none -->` marker is exactly what prevents that release — so
# one in a fragment vetoes every later merge, forever (#12928 stalled the
# release train for three weeks this way). Test-only/no-op changes want the
# `no-changelog` label and no fragment, not a none marker.
if grep -qE '<!-- *release: *none *-->' "$f"; then
echo "::error file=$f::'<!-- release: none -->' is not allowed in a fragment: fragments accumulate until a release is cut, so this marker would block every release until a human deletes it. Delete the fragment (and label the PR no-changelog) if the change is not user-visible; only major|minor|patch markers may ride in a fragment."
bad=1
fi
done < "$work_dir"/fragments.txt
if [ "$bad" -ne 0 ]; then
exit 1
Expand Down
19 changes: 16 additions & 3 deletions src/scripts/compile-changelog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@
# CHANGELOG.md edits therefore keep working alongside fragments, which is
# what the 7-day transition window relies on.
# - A fragment's first non-blank line must start with `- ` (an entry bullet)
# or be a `<!-- release: ... -->` marker, so the escape hatch
# derive-release-version.sh honours can also ride in a fragment.
# or be a `<!-- release: major|minor|patch -->` marker, so the bump escape
# hatch derive-release-version.sh honours can also ride in a fragment.
# `<!-- release: none -->` is REJECTED in fragments: a fragment persists
# until the release that consumes it, and `none` is what prevents that
# release, so one such fragment silently freezes every later merge.
# - Each fragment is deleted after a successful compile, so `git add -A
# changelog.d` in the release commit records the consumption.
#
Expand Down Expand Up @@ -117,7 +120,17 @@ for f in "${fragments[@]}"; do
echo "::error::${f}: fragment is empty" >&2
bad=1
elif ! [[ "$first_line" == "- "* || "$first_line" == "<!-- release:"* || "$first_line" == "<!--release:"* ]]; then
echo "::error::${f}: a fragment must start with a '- ' entry bullet (or a '<!-- release: ... -->' marker); it is the entry itself, not a section with its own headings" >&2
echo "::error::${f}: a fragment must start with a '- ' entry bullet (or a '<!-- release: major|minor|patch -->' marker); it is the entry itself, not a section with its own headings" >&2
bad=1
fi
# `none` is self-deadlocking in a fragment: the fragment lives until the
# release that consumes it, and the marker is what forbids that release.
# #12928 landed one on 2026-10-19 and every decide job for the next three
# weeks (~1,600 commits) skipped on "explicit human override" while nobody
# had asked for a freeze. Fail loudly here so the stall shows up as a red
# decide job on the very next merge instead of a quiet skip.
if grep -qE '<!-- *release: *none *-->' "$f"; then
echo "::error::${f}: '<!-- release: none -->' is not allowed in a fragment — it would veto every release until a human deletes it (see changelog.d/README.md). Delete the fragment instead; only major|minor|patch markers may ride in a fragment." >&2
bad=1
fi
done
Expand Down
26 changes: 25 additions & 1 deletion src/scripts/derive-release-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,26 @@ if [[ ${#markers[@]} -eq 1 ]]; then
fi

if [[ "$override" == "none" ]]; then
# A ::warning:: rather than a plain echo: this skip is a human-placed
# freeze, and a freeze nobody remembers placing looks exactly like a
# healthy no-op run (#12928 held releases for three weeks that way). Once
# the freeze has outlived RELEASE_FREEZE_MAX_DAYS (default 7) since the
# newest tag, fail the decide job outright so the stall turns red.
echo "::warning::CHANGELOG.md Unreleased section carries <!-- release: none -->; releases are frozen until that marker is removed."
echo "Unreleased section carries <!-- release: none -->; skipping this merge by explicit human override."
max_days="${RELEASE_FREEZE_MAX_DAYS:-7}"
newest_tag="$(git tag -l 'v[0-9]*.[0-9]*.[0-9]*' 2>/dev/null | sort -V | tail -1 || true)"
if [[ -n "$newest_tag" && "$max_days" -gt 0 ]]; then
tag_epoch="$(git log -1 --format=%ct "${newest_tag}^{commit}" 2>/dev/null || echo 0)"
if [[ "$tag_epoch" -gt 0 ]]; then
age_days=$(( ( $(date +%s) - tag_epoch ) / 86400 ))
if [[ "$age_days" -gt "$max_days" ]]; then
echo "::error::<!-- release: none --> has suppressed releases for ${age_days} days (newest tag ${newest_tag}; limit RELEASE_FREEZE_MAX_DAYS=${max_days}). Remove the marker from CHANGELOG.md's Unreleased section, or raise RELEASE_FREEZE_MAX_DAYS if the freeze is deliberate." >&2
emit release false
exit 1
fi
fi
fi
emit release false
exit 0
fi
Expand Down Expand Up @@ -151,7 +170,12 @@ else
# declared with the explicit `<!-- release: major -->` marker. Crossing a
# release line stays a human decision, which is what it already is
# everywhere else in this repo.
if printf '%s\n' "$unreleased" | grep -qE '^### Added[[:space:]]*$'; then
# No `grep -q` here: under `set -o pipefail` a -q grep exits on the first
# match and the printf feeding it dies of SIGPIPE once the body outgrows
# the pipe buffer (~64 KiB), turning a found `### Added` into pipeline
# failure => a silent patch. Seen live on the 1,369-fragment backlog
# compiled after #12928. Let grep read to EOF instead.
if printf '%s\n' "$unreleased" | grep -E '^### Added[[:space:]]*$' >/dev/null; then
bump=minor
else
bump=patch
Expand Down
34 changes: 34 additions & 0 deletions src/scripts/test-compile-changelog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,40 @@ else
note_ok "a fragment that is not a '- ' entry bullet is rejected"
fi

# ---------------------------------------------------------------------------
# Case 5b: `<!-- release: none -->` in a fragment is rejected (#12928). The
# fragment survives until a release consumes it, and the marker forbids that
# release — so one fragment would freeze every later merge. A bump marker
# (`patch`) in a fragment stays legal and still compiles verbatim.
# ---------------------------------------------------------------------------
dir=$(new_case 5b)
printf -- '<!-- release: none -->\n- a test-only tweak that should have been a no-changelog label.\n' > "$dir/changelog.d/changed-11-none.md"
printf -- '- a real fix ([#12](https://example.invalid/12)).\n' > "$dir/changelog.d/fixed-12-real.md"
if ( cd "$dir" && bash "$compile" CHANGELOG.md changelog.d ) > "$tmp/case5b.out" 2>&1; then
note_fail "a fragment carrying '<!-- release: none -->' must be rejected"
else
if grep -q 'release: none' "$tmp/case5b.out" && [[ -f "$dir/changelog.d/fixed-12-real.md" ]]; then
note_ok "a fragment carrying '<!-- release: none -->' is rejected loudly, with every fragment left on disk"
else
note_fail "rejection of a none-marker fragment must name the marker and leave fragments untouched: $(cat "$tmp/case5b.out")"
fi
fi

dir=$(new_case 5c)
git init -q "$dir"
git -C "$dir" config user.email test@example.com
git -C "$dir" config user.name "Test"
git -C "$dir" -c commit.gpgsign=false commit -q --allow-empty -m init
git -C "$dir" tag v1.0.0
printf -- '<!-- release: patch -->\n- an added thing that must only bump patch.\n' > "$dir/changelog.d/added-13-patch.md"
if ( cd "$dir" && bash "$compile" CHANGELOG.md changelog.d ) > "$tmp/case5c.out" 2>&1 \
&& grep -q '<!-- release: patch -->' "$dir/CHANGELOG.md" \
&& [[ "$(cd "$dir" && GITHUB_OUTPUT="" bash "$derive" CHANGELOG.md | grep -E '^(release|bump|version)=' | tr '\n' ' ')" == "release=true version=1.0.1 bump=patch " ]]; then
note_ok "a bump marker in a fragment still compiles and still forces the bump"
else
note_fail "a '<!-- release: patch -->' fragment must remain legal: $(cat "$tmp/case5c.out")"
fi

# ---------------------------------------------------------------------------
# Case 6: fenced prose that mentions `## Unreleased` must not be treated as
# the target section. This pins the #5918/#5939 bug class for both the
Expand Down
45 changes: 45 additions & 0 deletions src/scripts/test-derive-release-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,22 @@ else
note_fail "expected release=true bump=minor version=1.3.0, got: $out"
fi

# ---------------------------------------------------------------------------
# Case 3b: a very large Unreleased body (well past the ~64 KiB pipe buffer)
# with `### Added` near the top must still infer minor. A `grep -q` in the
# inference pipeline exits on first match, the feeding printf takes SIGPIPE,
# and pipefail turned that into "no Added => patch" on the 1,369-fragment
# backlog compiled after #12928.
# ---------------------------------------------------------------------------
big_body=$'## Unreleased\n\n### Added\n\n- first feature\n\n### Fixed\n\n'
big_body+="$(yes '- a long fixed entry line that pads the section well past the pipe buffer size so the test is meaningful.' | head -n 4000)"$'\n'
out=$(run "$big_body" v1.2.3)
if [[ "$(get "$out" release)" == "true" && "$(get "$out" version)" == "1.3.0" ]]; then
note_ok "### Added in a >64KiB Unreleased body still infers minor (no SIGPIPE/pipefail regression)"
else
note_fail "expected 1.3.0 from a large Added-carrying section, got: $(printf '%s' "$out" | tail -3)"
fi

# ---------------------------------------------------------------------------
# Case 4: ### Security present is release-worthy but does not cut a new
# release line by itself, so Added still controls the minor bump.
Expand All @@ -96,6 +112,35 @@ else
note_fail "expected release=false with release:none marker, got: $out"
fi

# ---------------------------------------------------------------------------
# Case 5b: a release:none freeze that has outlived RELEASE_FREEZE_MAX_DAYS
# since the newest tag fails the decide job loudly (#12928: three silent
# weeks). Same marker on a fresh tag (case 5) stays a quiet release=false;
# RELEASE_FREEZE_MAX_DAYS=0 disables the age check.
# ---------------------------------------------------------------------------
old_epoch=$(( $(date +%s) - 30 * 86400 ))
GIT_AUTHOR_DATE="@${old_epoch} +0000" GIT_COMMITTER_DATE="@${old_epoch} +0000" \
git -C "$repo" commit -q --allow-empty -m "old release point"
git -C "$repo" tag -d $(git -C "$repo" tag -l 'v*') >/dev/null 2>&1 || true
git -C "$repo" tag -f v2.0.0 >/dev/null 2>&1
printf '%s' $'## Unreleased\n\n<!-- release: none -->\n\n### Added\n\n- frozen\n' > "$repo/CHANGELOG.md"
if out=$( cd "$repo" && GITHUB_OUTPUT="" bash "$derive" CHANGELOG.md 2>&1 ); then
note_fail "a 30-day release:none freeze must fail the decide job, got exit 0: $out"
elif printf '%s' "$out" | grep -q '::error::.*release: none.*30 days'; then
note_ok "release:none freeze older than RELEASE_FREEZE_MAX_DAYS fails loudly with its age"
else
note_fail "expected a ::error:: naming the freeze age, got: $out"
fi
if out=$( cd "$repo" && GITHUB_OUTPUT="" RELEASE_FREEZE_MAX_DAYS=0 bash "$derive" CHANGELOG.md 2>&1 ) \
&& [[ "$(get "$out" release)" == "false" ]]; then
note_ok "RELEASE_FREEZE_MAX_DAYS=0 disables the freeze-age check"
else
note_fail "expected a quiet release=false with the age check disabled, got: $out"
fi
# Later cases tag the current commit; leave it dated now again.
git -C "$repo" commit -q --allow-empty -m "back to now"
git -C "$repo" tag -d $(git -C "$repo" tag -l 'v*') >/dev/null 2>&1 || true

# ---------------------------------------------------------------------------
# Case 6: escape hatch forces a bump type regardless of headers present.
# ---------------------------------------------------------------------------
Expand Down
Loading