# Site images: immutable sha tags pinned in git Every first-party site image runs from a **tag pinned in this repo** and is rolled by Flux. CI builds and pushes `:` and prints the exact ref; the operator copies that ref into the Deployment manifest. There are **no cluster credentials in any site repo** — CI cannot roll a Deployment and cannot read a kubeconfig. This replaces the old model (`:latest` + `imagePullPolicy: Always` + CI patching `kubectl.kubernetes.io/restartedAt` through a `site-deployer` ServiceAccount token). That path is gone: the SA/Role/RoleBinding were removed and the `KUBE_CONFIG` action secrets deleted. ## Operator flow 1. Push to a site repo (or `workflow_dispatch` it). The workflow builds the amd64 image, pushes `/:`, and ends with a `### Pin this in sirius/homek8s …` step that prints the ref. It also pushes `:latest`, but **nothing in the cluster reads `:latest`** — it is a convenience pointer for humans only. 2. Edit the Deployment in `apps/base//deployment*.yaml`: ```yaml image: forgejo.siriusdevops.com/sirius/: imagePullPolicy: IfNotPresent ``` 3. Commit + push `master`, then force the Flux recheck (gitrepository **first**, kustomization **second** — an `apps` annotate that still reports the previous sha has not fetched the commit): ```bash kubectl -n flux-system annotate gitrepository flux-system reconcile.fluxcd.io/requestedAt="$(date +%s)" --overwrite kubectl -n flux-system annotate kustomization apps reconcile.fluxcd.io/requestedAt="$(date +%s)" --overwrite ``` 4. Verify: the pod template changed, so the Deployment rolls within ~1m and the pod reports the pinned ref. ```bash kubectl -n get pods -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.containerStatuses[0].imageID}{"\n"}{end}' ``` `imageID` must name `:` and carry the digest the registry returns for that tag (`Docker-Content-Digest`, below). Rollback is `git revert` of the pin commit — Flux reconciles back in ~1m. ## Why the site repos are not Flux sources The only `GitRepository` cluster-wide is `flux-system` → `sirius/homek8s`. Flux owns the *manifests*; the site repos own only their image builds. The content revision a visitor sees is therefore chosen by the tag committed here, not by whatever CI pushed last. A site repo push alone changes nothing in the cluster. ## Current pins | Namespace | Deployment | Image ref | |---|---|---| | siriusdevops | siriusdevops-site | `siriusdevops-site:f0dde2f48c8224fb80d801ecb0d155c93332dc13` | | siriusdevops | siriusdevops-contact | `siriusdevops-contact:f0dde2f48c8224fb80d801ecb0d155c93332dc13` | | sirius-growth | sirius-growth-site | `sirius-growth-site:ea306b73b0d7c9ae8c33393a420e6d1d452b802b` | | sirius-growth | sirius-growth-portal | `sirius-growth-portal:d9e558c4e0922d3ecd28214f7698ec0994170481` | | sirius-growth | sirius-growth-contact | `sirius-growth-contact:c9c9379ebceca6879d3bbeff1c2601b6484e87b0` | | piedmont | piedmont-site | `phs-site:5b590cddab6d7889fdd3c272255f28c4560e752e` | | piedmont | piedmont-contact | `phs-contact:5035443abb62913362e416ab7030a64726886886` | Each pin is the tag CI printed for the commit that was deployed. (The first six pins were chosen as the tag whose manifest was **the image already running**, so pinning was a no-op for visitors; the two contact APIs were re-pinned after their pipelines first ran — same source, freshly built.) ### Contact APIs Both contact APIs now build in CI, on `docker-amd64`, tagging `:$sha` and promoting `:latest` as a pointer only: | Repo | Workflow | `paths:` | Source | Image | |---|---|---|---|---| | `sirius-growth` (`master`) | `.forgejo/workflows/deploy-contact.yml` | `contact-api/**` | `contact-api/` | `sirius/sirius-growth-contact` | | `sirius/websites` (`main`) | `.forgejo/workflows/deploy-phs-contact.yml` | `phs-contact-api/**` | `phs-contact-api/` | `sirius/phs-contact` | They used to be hand-built (`:latest` only) and therefore pinned by `@sha256:`. A change to either API is now a push → printed `:` ref → bump the pin here. ## Registry facts - Registry: `forgejo.siriusdevops.com` (Forgejo packages, `[packages] ENABLED = true`). - Reads/writes need a `read:package` / `write:package` scoped token; the stored `~/.git-credentials` oauth2 token is git-scoped and is rejected by `/v2/`. - **Tags do not expire.** `package_cleanup_rule` has zero rows and `app.ini` has no cleanup cron, so a pinned `:` stays resolvable. - Prove a pin `T` for image `I` without pulling anything: ```bash curl -s -u "sirius:$TOK" -H 'Accept: application/vnd.oci.image.index.v1+json,application/vnd.docker.distribution.manifest.list.v2+json,application/vnd.docker.distribution.manifest.v2+json' \ -D - -o /dev/null "https://forgejo.siriusdevops.com/v2/sirius/$I/manifests/$T" | grep -i docker-content-digest ``` ## Pitfalls - **`docker buildx imagetools create` (the `:latest` promote step) wraps a single-arch image in an index**, so the `:latest` digest differs from the `:` digest even though the content is identical. Compare the *config* digest, or compare the running pod's digest to the `:` tag, never `:latest` vs the sha tag. - The amd64 runner's job image (`node:20-bullseye`) has no docker CLI, so the site workflows fetch the binaries each run — and both hosts have been observed to stall for the full 300s (`curl: (28) … 0 out of 0 bytes`). The static docker client tries `download.docker.com` then `mirrors.aliyun.com`; **buildx is copied out of the `docker:27-dind` image the runner already holds** (`docker create docker:27-dind` → `docker cp …/cli-plugins/docker-buildx`), with the GitHub release URL only as a fallback. Before that change a three-attempt retry of the GitHub CDN failed all three times inside a job container while the same URL fetched fine outside one. - `runs-on` matters: site images are `linux/amd64` and only siriussec serves them. Build them on `docker-amd64` / `deploy-arm64`, never on the arm64 `docker` runner.