diff --git a/.gitea/workflows/publish-image.yml b/.gitea/workflows/publish-image.yml index 4ab6b9e..9eb9d28 100644 --- a/.gitea/workflows/publish-image.yml +++ b/.gitea/workflows/publish-image.yml @@ -9,6 +9,24 @@ on: push: tags: - 'v*' + # Manual rehearsal from the Gitea UI (Actions -> Publish image -> Run + # workflow). `push` defaults to false: the job builds and smoke-tests, then + # stops without publishing, so the runner can be verified without creating + # a tag or a package version. Set `push` to true (and `latest` only for a + # real release) to publish. + workflow_dispatch: + inputs: + version: + description: 'Version to build, e.g. v0.0.1 (vMAJOR.MINOR.PATCH)' + required: true + push: + description: 'Push the image to the registry' + required: false + default: 'false' + latest: + description: 'Also move :latest (real releases only)' + required: false + default: 'false' # The runner has capacity 1, so releases already serialize. This keeps a # manual re-run from racing a fresh release on the same tags. @@ -72,10 +90,19 @@ jobs: - name: Resolve version and tags id: version + env: + # Inputs go through env, not direct interpolation: a value pasted + # into a `run:` block is shell code before any check can run. + INPUT_VERSION: ${{ github.event.inputs.version }} + INPUT_LATEST: ${{ github.event.inputs.latest }} run: | - # GITHUB_REF_NAME is the tag on a tag push. The git fallback keeps - # this working if a runner version does not set it. - version="${GITHUB_REF_NAME:-$(git describe --tags --exact-match HEAD)}" + # On a tag push GITHUB_REF_NAME is the tag; on workflow_dispatch it + # is the BRANCH, so the manual version input must win. The git + # fallback keeps tag pushes working if a runner omits the variable. + version="$INPUT_VERSION" + if [ -z "$version" ]; then + version="${GITHUB_REF_NAME:-$(git describe --tags --exact-match HEAD)}" + fi # Strict semver, not a `v[0-9]*` prefix match: that would accept # `v1`, `v1-anything` and prereleases, all valid registry tags. if ! printf '%s' "$version" | grep -qE '^v[0-9]+\.[0-9]+\.[0-9]+$'; then @@ -91,7 +118,13 @@ jobs: # A tag comparison needs the other tags, which a depth-1 tag # checkout does not have. If the fetch fails, skip `latest` and # say so - a wrong tag is worse than a missing one. - if git fetch --tags --force --quiet origin 2>/dev/null; then + # + # A manual run moves `latest` only when the `latest` input says so; + # a rehearsal must never repoint the production tag. + if [ "$INPUT_LATEST" = "true" ]; then + latest=true + echo "manual run requested :latest" + elif git fetch --tags --force --quiet origin 2>/dev/null; then newest="$(git tag -l | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -n 1)" if [ "$version" = "$newest" ]; then latest=true @@ -128,6 +161,9 @@ jobs: | docker login git.noelsabia.dev -u "$REGISTRY_USERNAME" --password-stdin - name: Refuse to overwrite a published version + # Build-only rehearsals publish nothing, so an existing tag is not a + # conflict there; the guard only protects actual pushes. + if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.push == 'true' }} env: REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }} REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} @@ -213,6 +249,8 @@ jobs: run: docker tag "${IMAGE}:${VERSION}" "${IMAGE}:latest" - name: Push image + # Manual run with `push` left at false: build and smoke test only. + if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.push == 'true' }} env: VERSION: ${{ steps.version.outputs.version }} SHA: ${{ steps.version.outputs.sha }} @@ -228,3 +266,13 @@ jobs: else echo "Pushed ${IMAGE}:${VERSION}, :sha-${SHA} (:latest untouched)" fi + + - name: Rehearsal summary + if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.push != 'true' }} + env: + VERSION: ${{ steps.version.outputs.version }} + SHA: ${{ steps.version.outputs.sha }} + run: | + echo "Build-only rehearsal for ${VERSION} (${SHA}) - the image passed the smoke test and was NOT pushed." + echo "Re-run with push=true to publish it." + diff --git a/Dockerfile b/Dockerfile index aba0c9e..e756557 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,11 +12,14 @@ # edits invalidate almost nothing. # # Base image is digest-pinned to the same node:26-slim digest as the dev -# container (OKF_Nuxt/decisions/dev-container-shape.md) - verified for the -# runner's arm64 and this workstation's x86_64. +# container (OKF_Nuxt/decisions/dev-container-shape.md). The digest is the +# multi-platform OCI INDEX, not a platform manifest: the previous pin was +# the linux/amd64 manifest digest, so `--platform linux/arm64` on the arm64 +# runner failed instantly with "no matching manifest for linux/arm64". +# Index digest verified 2026-10-31 to contain linux/amd64 and linux/arm64/v8. # syntax: no BuildKit-only features used, so the default frontend suffices. -FROM node:26-slim@sha256:18f03e4b532a63baf09809fe8349c2171807f1818cb6c5230fb12aecd5beda65 AS build +FROM node:26-slim@sha256:e4db4c914bf8ad241bd24804fc25d272d89bad97e68cdc8a1414862790a02c39 AS build # pnpm pinned to the same version as CI (pr-checker.yml pins major 11) and # the local toolchain (11.26.0). Installed via npm from the node image - no @@ -38,7 +41,7 @@ COPY . . RUN pnpm build -FROM node:26-slim@sha256:18f03e4b532a63baf09809fe8349c2171807f1818cb6c5230fb12aecd5beda65 +FROM node:26-slim@sha256:e4db4c914bf8ad241bd24804fc25d272d89bad97e68cdc8a1414862790a02c39 # pnpm is NOT installed in the runtime image: nothing here runs pnpm. ENV NODE_ENV=production \ diff --git a/Dockerfile.dev b/Dockerfile.dev index c548d1a..1cdc86f 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,4 +1,4 @@ -FROM node:26-slim@sha256:18f03e4b532a63baf09809fe8349c2171807f1818cb6c5230fb12aecd5beda65 +FROM node:26-slim@sha256:e4db4c914bf8ad241bd24804fc25d272d89bad97e68cdc8a1414862790a02c39 # Node no longer bundles pnpm (corepack and pnpm are both absent from this # image), so install it. First instruction, so later changes reuse the layer. diff --git a/OKF_Nuxt/decisions/production-image.md b/OKF_Nuxt/decisions/production-image.md index 6b52877..93d3d62 100644 --- a/OKF_Nuxt/decisions/production-image.md +++ b/OKF_Nuxt/decisions/production-image.md @@ -34,6 +34,17 @@ the gateway must now **proxy to this server** instead of embedding `.output/public/`. That sibling decision needs updating; the compose wiring is still open. +# The arm64 digest lesson (2026-10-31) + +The first real release (`v1.5.0`, `v1.5.1`) failed at `Build image` after one +second: the pinned `sha256:18f03e4b...` was the **linux/amd64 platform +manifest**, not the multi-platform index, so `docker build --platform +linux/arm64` on the arm64 runner found no arm64 entry. The base is now +pinned to the OCI **index** digest (`sha256:e4db4c91...`, contains +linux/amd64 and linux/arm64/v8). Rule: a digest pin for a multi-arch image +must be the index digest; `docker buildx imagetools inspect` prints both, +and the platform manifests carry a `Platform:` line. + # Why `--ignore-scripts` The `postinstall` script (`nuxt prepare`) runs before the source is copied diff --git a/OKF_Nuxt/decisions/registry-publishing.md b/OKF_Nuxt/decisions/registry-publishing.md index 4d01f45..2304784 100644 --- a/OKF_Nuxt/decisions/registry-publishing.md +++ b/OKF_Nuxt/decisions/registry-publishing.md @@ -142,6 +142,25 @@ appears in the process list or the log. 4. Namespace `cv` has an `imagePullSecret` for the same credentials. 5. `git.noelsabia.dev` answers over HTTPS. +# Manual rehearsal (workflow_dispatch) + +The workflow can be started from the Gitea UI (Actions → Publish image → +Run workflow) without creating a tag: + +| Input | Use | +|---|---| +| `version` | required, `vMAJOR.MINOR.PATCH` | +| `push` | `false` (default) builds and smoke-tests only; `true` publishes | +| `latest` | `false` unless this is a real release | + +A build-only run publishes nothing, so it creates no package version and +the immutability guard is skipped. This is the way to prove the runner, +socket and registry login before the first release - a rehearsal must never +move `latest`, which is why that input is explicit. + +Gitea only offers the Run-workflow button for workflows present on the +default branch, so this trigger is available once the change is on `main`. + # Guards in the workflow | Guard | Why | diff --git a/OKF_Nuxt/log.md b/OKF_Nuxt/log.md index 4737878..7eaebfa 100644 --- a/OKF_Nuxt/log.md +++ b/OKF_Nuxt/log.md @@ -1,5 +1,10 @@ # Update Log +## 2026-10-31 (first release builds failed: pinned the amd64 manifest) + +* **Fix**: [Dockerfile](../Dockerfile) and [Dockerfile.dev](../Dockerfile.dev) - the base digest `sha256:18f03e4b...` was the **linux/amd64 platform manifest**, so `docker build --platform linux/arm64` on the arm64 runner failed at `Build image` one second after the step started (run 157, v1.5.1; run 153, v1.5.0). Both now pin the multi-platform OCI **index** digest `sha256:e4db4c91...`, verified with `docker buildx imagetools inspect` to contain linux/amd64 and linux/arm64/v8. See [Production image shape](decisions/production-image.md). +* **Detail**: checkout, Docker CLI install, `Check daemon access`, registry login, the immutability guard and version resolution all passed - the runner and registry setup were correct; only the base image pin was wrong. + ## 2026-10-31 (release-please tag: empty package-name is the verified fix) * **Correction**: removing `package-name` in #36 was not enough. Run 183 shows the node strategy falling back to `package.json` `name`, so the release phase still failed with `PR component: undefined does not match configured component: nuxt-app`. @@ -54,6 +59,10 @@ * **Creation**: `deploy/pr-agent/` (later removed; the service now lives in the Gitea compose stack) - compose service, example environment and operator README. The real `.env` lived only at `/home/noel/self-hosted/pr-agent/.env` (mode 600) on `server0`. * **State**: the container is running and the webhook signature path is verified. Gitea gained `[webhook] ALLOWED_HOST_LIST = private:3000` (one restart, healthy) and the repository has a signed webhook. The OpenCode Go API key was still missing at commit time, so no model call or real review has run yet. +## 2026-10-31 (manual publish rehearsal without a tag) + +* **Creation**: [publish-image.yml](../.gitea/workflows/publish-image.yml) gained `workflow_dispatch` with `version`, `push` and `latest` inputs. Default is **build + smoke test only** (`push=false`): no tag, no package version, immutability guard skipped, `latest` never moved unless explicitly requested. Use it to verify the `publish` runner (socket + `automount`) before the first release. Manual runs do not replace the tag path - a published image still always maps to a release tag. + ## 2026-10-31 (audit green again: nuxt 4.6.3 and dependency overrides) * **Fix**: `pnpm audit --prod --audit-level moderate` failed on every branch (#30, #31, #33 and this PR) - new advisories plus a Nuxt patch release. `nuxt` 4.6.2 -> **4.6.3** clears GHSA-9v7c-q64q-vv33 (dot-segment middleware bypass), GHSA-3xf4-9g3c-4h4w and GHSA-x287-wcfc-q46c (dev-server file read/runtime config).