fix: pass commit hash to Hugo so website-verify.sh finds x-version #362

Merged
guettlibot merged 1 commits from refs/pull/362/head into main 2026-06-03 14:43:27 +00:00
guettlibot commented 2026-06-03 14:01:47 +00:00 (Migrated from codeberg.org)

Root cause

BuildWebsite and PublishWebsite in ci/main.go ran hugo --minify without setting the HUGO_PARAMS_GITVERSION environment variable. Hugo maps that env var to site.Params.gitversion, which the website/layouts/_partials/extend_head.html template uses to render <meta name="x-version" content="..."> in the page <head>.

Without that meta tag, website-verify.sh (which greps for x-version.*${VERSION} in the live HTML) always timed out and reported failure — even though the site itself was deployed successfully.

Fix

  • Added an optional commitHash parameter to BuildWebsite and PublishWebsite in ci/main.go. When provided, it is passed to the Hugo container via WithEnvVariable("HUGO_PARAMS_GITVERSION", commitHash) — consistent with how BuildLinuxRelease and friends already inject GIT_HASH.
  • Updated task publish-website in Taskfile.yml to compute HASH=$(git rev-parse --short HEAD) and forward it as --commit-hash "$HASH" — matching the pattern used by task deploy-linux.

Verification

  • gofmt passes on the modified ci/main.go.
  • The logic mirrors the existing BuildLinuxRelease pattern that already works in CI.

Closes #360

## Root cause `BuildWebsite` and `PublishWebsite` in `ci/main.go` ran `hugo --minify` without setting the `HUGO_PARAMS_GITVERSION` environment variable. Hugo maps that env var to `site.Params.gitversion`, which the `website/layouts/_partials/extend_head.html` template uses to render `<meta name="x-version" content="...">` in the page `<head>`. Without that meta tag, `website-verify.sh` (which greps for `x-version.*${VERSION}` in the live HTML) always timed out and reported failure — even though the site itself was deployed successfully. ## Fix - Added an optional `commitHash` parameter to `BuildWebsite` and `PublishWebsite` in `ci/main.go`. When provided, it is passed to the Hugo container via `WithEnvVariable("HUGO_PARAMS_GITVERSION", commitHash)` — consistent with how `BuildLinuxRelease` and friends already inject `GIT_HASH`. - Updated `task publish-website` in `Taskfile.yml` to compute `HASH=$(git rev-parse --short HEAD)` and forward it as `--commit-hash "$HASH"` — matching the pattern used by `task deploy-linux`. ## Verification - `gofmt` passes on the modified `ci/main.go`. - The logic mirrors the existing `BuildLinuxRelease` pattern that already works in CI. Closes #360
Sign in to join this conversation.