ci(artifacthub): structured changelog with link on major - #1925
Conversation
|
Nice one — the breaking-change link on major is exactly what we were missing after #1898. Few things I'd tweak before it goes in: The gitmoji stripping doesn't fully work — the regex only catches text shortcodes like Also, every release ends up listing its own Small hardening: Last one, and the bigger one: right now everything that isn't feat/fix falls into
|
|
Pushed 8c922f1 with all four points, ready for another pair of eyes while @mloiseleur is away.
Re-ran against the real |
|
@bpsoraggi could you have a look ? |
Emit the structured artifacthub.io/changes annotation so Artifact Hub renders per-kind badges (feat->added, fix->fixed, else changed) and strips gitmoji shortcodes. On a major release (X.0.0), collapse the annotation to a single 'changed' entry that links to the release Upgrade Notes, so the breaking-change signal is not buried in a long commit list.
The major-release shortcut assumed a single chart with a bare `v<version>` tag. With hub-manager in the loop, its 1.0.0 initial release was flagged as breaking and linked to a tag that does not exist. Scope release links per chart, restrict the major-release shortcut to charts that already have a previous release, and drop the release commit in both the `chore(release):` and plain `chore:` forms.
4df02ba to
a522ea4
Compare
A version whose only commit is the release commit had every line filtered out, leaving `artifacthub.io/changes: |` with no entries: not a valid change list. Skip the chart instead. Drop the `perf` and `revert` cases: `perf` was identical to the default, and Artifact Hub's `removed` means a feature was removed, which a revert is not. Both fall through to `changed`.
Artifact Hub renders unicode emoji, so there is nothing to gain from stripping
it, and matching it needed `perl -CSD` with `\p{Extended_Pictographic}`: an
undeclared dependency, while the script otherwise guards its tooling. Only
`:shortcode:` still has to go, since that one shows up verbatim.
Stripping is now plain GNU sed, which the script already requires. The release
commit filter no longer runs on emoji-free input, so it tolerates a leading
token: `chore(release): <emoji> publish ...`. Checked against the full history,
826 commit lines, no legitimate commit dropped.
3007813 to
1b6808e
Compare
Four defects in the structured artifacthub.io/changes generation: - The gitmoji shortcode strip was global and unanchored, so any colon pair was eaten: "handle note⚠️ markers" became "handle notemarkers", and a URL lost part of its path. It now only strips shortcodes where gitmoji actually sits, leading or right after the conventional commit type. - Skipping a chart with no extractable change left the previous version's annotation in place, advertising stale changes on the new version. It now falls back to a single entry naming the release. - The release commit filter allowed any word between the type and the release keyword, so "chore(deps): update release process docs" was dropped. That slot is now restricted to a rendered gitmoji. - A breaking marker mapped to added. Artifact Hub has no breaking kind, so it falls back to changed.
d23a7cc to
d4d4767
Compare
hack/changelog.sh had no coverage. Each case under .github/fixtures/artifacthub-changes/ pins one behaviour: kind mapping and escaping on a patch, the upgrade notes link on a major, a first release that is X.0.0 without being breaking, and a release whose only commit is the release itself. Run them with `make test-changelog`, refresh them with `REGENERATE=1 ./hack/test-changelog.sh`. The Test workflow calls the same make target, next to the other shell checks, so there is one way to run them and no extra runner for a test that needs nothing but bash. Reading the chart version now uses sed instead of yq: `yq -r` is python-yq only, mikefarah yq has no -r flag, so the script could not run on a GitHub runner. It drops a dependency from `make changelog` too.
d4d4767 to
8f809ed
Compare
Rewriting the annotation deleted everything from artifacthub.io/changes to the end of Chart.yaml, so any annotation sorting after it was silently dropped. Delete only the block instead. An empty changes list now fails rather than falling back to a "Release X" entry. It means Chart.yaml and Changelog.md are out of sync, or the version holds nothing but its own release commit, and no release is changeless. The golden tests only compared bytes, so REGENERATE happily blessed a broken annotation. They now parse it and check every kind against the ones Artifact Hub accepts, in syntax both mikefarah yq and python-yq run.
What does this PR do?
Emit the structured
artifacthub.io/changesannotation fromhack/changelog.sh:feat→added,fix→fixed, breaking or anything else→changed), gitmoji shortcodes stripped, release commit dropped.X.0.0) → singlechangedentry linking to the release Upgrade Notes.Generated output — last 5 versions
Rewriting the annotation deletes only its own block, so an annotation sorting after
artifacthub.io/changesis no longer dropped. An empty result aborts instead of writing a placeholder: it meansChart.yamlandChangelog.mdare out of sync, and no release is changeless.Covered by golden tests in
.github/fixtures/artifacthub-changes/, run bymake test-changelog, which the Test workflow calls next tomake test-ns. Each case pins one behaviour: kind mapping, escaping and block replacement on a patch, the upgrade notes link on a major, a first release that isX.0.0without being breaking, and a release whose only commit is the release itself, which is refused. The tests also parse the emitted annotation and check every kind against the ones Artifact Hub accepts, so regenerating the golden files cannot bless a broken one.Reading the chart version moved from
yqtosed:yq -ris python-yq only and mikefarah yq has no-rflag, so the script could not run on a GitHub runner. The tests do useyq, in syntax both flavours run.Motivation
Artifact Hub buried the v41 breaking changes in a flat commit list (#1898). Artifact Hub has no "breaking" kind, so a major collapses to one entry pointing at the upgrade guide — impossible to miss.
More
make test-changelogand all the tests passed