Skip to content

Stop rebuilding the Helm index from scratch on every release - #19

Merged
mbakalarski merged 1 commit into
mainfrom
fix/helm-index-merge
Aug 4, 2026
Merged

Stop rebuilding the Helm index from scratch on every release#19
mbakalarski merged 1 commit into
mainfrom
fix/helm-index-merge

Conversation

@mbakalarski

Copy link
Copy Markdown
Member

The defect

helm repo index --merge takes a file path, not a URL. release-on-tag.yaml handed it a URL:

helm repo index .cr-index --url "${repo_url}" \
  --merge https://netclab.github.io/netclab-chart/index.yaml || true

helm merges nothing and exits 0, so || true was hiding nothing — helm itself reported success. Reproduced with helm v4.1.3:

--merge argument result
URL exit 0, merge silently skipped
file path exit 0, merged correctly

Every release therefore published an index containing exactly one chart.

The damage

The published index listed 1 version (0.5.11) while 15 releases carry tarballs, back to v0.3.2:

helm search repo netclab --versions          →  0.5.11 only
helm show chart netclab/netclab --version 0.5.9
  Error: no chart version found for netclab-0.5.9
curl …/releases/download/v0.5.9/netclab-0.5.9.tgz   →  200

Nothing was lost — urls: points at GitHub Releases, and the tarballs are all there — but helm could not see them. It went unnoticed because every consumer pins the newest version, which was the one version in the index.

Already repaired on gh-pages (a14fcd2): the index now holds all 15 versions, 0.3.2 → 0.5.11, each pointing at its own release. This PR fixes the cause.

The fix

  • Fetch the index to a file with curl -fsSL, then --merge that file, with an else branch for the first-ever release.
  • Drop || true, so a genuine failure fails the release rather than publishing a truncated index.
  • New step "Refuse to publish an index that lost versions", comparing the entry count before and after.

Verification

path before → after guard
fixed command, new chart 15 → 16, correct per-version URL passes
old command (regression) 15 → 1 blocks the publish

yq is preinstalled on ubuntu-24.04 (4.53.3) — checked rather than assumed, since nothing else in this repo's CI uses it and a failure in this step would break a release after the tag.

The index URL deliberately stays on netclab.github.io: it works today and keeps working after the domain move through a 301 that curl -L follows, so this fix does not wait on the site migration.

🤖 Generated with Claude Code

`helm repo index --merge` takes a file path, not a URL. Handed a URL it
merges nothing and still exits 0, so `|| true` was hiding nothing --
helm itself reported success while publishing an index that listed only
the chart just built. Every release since v0.3.2 discarded the history;
the tarballs survived on GitHub Releases, but helm could not see them.

Fetch the published index to a file first, then merge that file, with an
`else` branch for the case where no index exists yet. Drop `|| true`, so
a real failure now fails the release instead of publishing a truncated
index.

Add a guard that refuses to publish when the index came out with fewer
versions than it went in with. This failure was silent for nine
releases; the next one should not be. Verified both ways: the fixed
command takes the index from 15 versions to 16, and the old command
takes it from 15 to 1 with the guard blocking the publish.

The index URL deliberately stays on netclab.github.io. It works today and
keeps working after the domain move through a 301 that curl -L follows,
so this fix waits on nothing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@mbakalarski
mbakalarski merged commit ae8a184 into main Aug 4, 2026
1 check passed
@mbakalarski
mbakalarski deleted the fix/helm-index-merge branch August 4, 2026 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant