Skip to content

Stamp the image version and gate the chart version bumps - #2

Merged
byjg merged 2 commits into
masterfrom
fix/image-version-and-release-notes
Sep 18, 2026
Merged

byjg merged 2 commits into
masterfrom
fix/image-version-and-release-notes

Conversation

@byjg

@byjg byjg commented Sep 18, 2026

Copy link
Copy Markdown
Owner

What

Four related fixes around versioning, plus a guard so they cannot regress.

The image never knew its own version

Makefile derives VERSION from git describe, but the Docker build context only copies go.mod main.go Makefile — there is no .git in the builder stage. git describe always failed and fell back to dev, so every image ever published reported static-httpserver dev.

The version is now resolved on the runner (git describe, with fetch-depth: 0) and passed in as a build argument. Verified locally: --build-arg VERSION=v9.9.9-test produces static-httpserver v9.9.9-test; with no argument it falls back to dev.

The image tags were wrong

A github-script step stripped and rejoined metadata-action's output to build :latest-${result}, giving tags like latest-v0.5.0 and latest-master. It also referenced a step ID (steps.set-result) that does not exist.

docker/metadata-action now emits the tags directly:

trigger image tags binary -version
push master :latest v0.5.0-3-gabc1234
tag v0.5.0 :0.5.0, :0.5, :latest v0.5.0
pull request :pr-N (built, not pushed) v0.5.0-3-gabc1234

build-multiarch.sh is brought in line: it never passed the version through either, and hardcoded VERSION="latest" as both the tag and the version.

Release notes

changelog: use: github-native — GitHub's merged-PR list instead of a flat commit dump. The sort/filters block is removed because github-native ignores it.

A version gate

scripts/check-version.sh, run on pull requests and on tags only — master and feature branches are not gated.

A published chart version is immutable in practice. Republishing one overwrites its .tgz and the previous release disappears from the repo index entirely. Measured against a real Helm 4.3.0 repo: same chart version, new appVersion, and the digest changes under an unchanged version number, leaving exactly one entry with no rollback target.

PR touches chart version appVersion
nothing relevant (README, .github/)
helm/** only (excl. Chart.yaml) must bump
app files (main.go, go.mod, Makefile, Dockerfile, html/) must bump must bump

An app change requires a chart bump because appVersion lives inside Chart.yaml and the chart is republished on every merge to master — bumping appVersion alone emits a new .tgz at an unchanged chart version.

On a tag: appVersion must equal the tag (v0.6.00.6.0), and the chart version must differ from the previous tag's.

Chart.yaml is excluded from "the chart changed" detection, otherwise bumping appVersion would demand a chart bump for that edit alone.

The if sits on the step, not the job: a skipped job also skips everything that needs it, which would take the whole build down on every master push.

Expected to fail

This PR trips its own gate. Dockerfile and Makefile are app files, and Chart.yaml still reads version: 0.3.0 / appVersion: "latest". That needs a decision — appVersion: "latest" can never match a release tag, and because deployment.yaml uses .Chart.AppVersion as the image tag default, changing it also changes which image the chart pulls.

Also

.gitpod.yml was an unused stub (echo 'TODO: build project').

🤖 Generated with Claude Code

The Docker build context carries no .git, so the Makefile's `git describe`
never resolved and every published image reported itself as "dev". The
version is now resolved on the runner and handed to the build as an
argument.

The image tags were assembled by a github-script step that stripped and
rejoined the metadata action's output, which produced :latest and
:latest-v0.5.0. docker/metadata-action emits them directly instead: master
publishes :latest, a release tag publishes :X.Y.Z, :X.Y and :latest. The
same scheme is mirrored in build-multiarch.sh, which also never passed the
version through.

Release notes come from GitHub's own generator rather than a commit dump.

scripts/check-version.sh runs on pull requests and on tags. A published
chart version is immutable in practice: republishing one overwrites its
.tgz and drops the previous release from the repository index entirely.
The check refuses a change that did not move the versions it affects, and
refuses a tag whose appVersion disagrees with it. Pushes to master and to
feature branches are not gated.

The .gitpod.yml stub is unused and goes with it.
The version gate requires both to move when the application changes, and
appVersion has to name a real release instead of "latest" so it can match
the tag that publishes it.
@byjg
byjg merged commit 3db6cd4 into master Sep 18, 2026
5 checks passed
@byjg
byjg deleted the fix/image-version-and-release-notes branch September 18, 2026 03:58
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