ci: push amd64 images to the in-cluster Forgejo registry #63

Merged
sirius merged 2 commits from wt/ci-in-cluster-registry into master 2026-11-17 20:10:37 +00:00
Owner

Why the build has been red

Every failed run since 2026-11-14 (1342 → 1362) dies in ~6 s at Login to Forgejo registry, job log (job 2005, run 1362):

plan app=1 scraper=1 summarizer=0 pg=0 compose=0
Push registry: 127.0.0.1:3000
Error response from daemon: Get "http://127.0.0.1:3000/v2/": dial tcp 127.0.0.1:3000: connect: connection refused

Identical single error in jobs 1986, 2003, 2005. build.yml is byte-identical to the last green run (285, 2026-09-01) — nothing in this repo broke it. Forgejo moved out of the Pi's docker into k8s, so inside an in-cluster job pod 127.0.0.1:3000 is the pod's own loopback.

The permissions: block is not the failure: Forgejo ignores job-level permissions and only emits a pre-execution warning ("has a permissions field, which is not supported in Forgejo and will be ignored"). Removing it silences the warning; it does not fix the run.

What this changes

before after
PUSH_REGISTRY: 127.0.0.1:3000 forgejo.forgejo.svc.cluster.local:3000 (in-cluster ClusterIP, plain HTTP)
runs-on: docker → matched pi-arm64 only, built arm64 images the amd64 cluster can't run runs-on: amd64 → siriussec-amd64, the node the workloads run on
permissions: contents: read / packages: write removed (ignored by Forgejo; push uses the FORGEJO_TOKEN PAT)
tags :latest + :<sha12> one canonical amd64-<sha12>
"Deploy on runner host (compose)" — ran docker compose against the dind daemon, redeploying nothing dropped; deploys are pinned tags in homek8s apps/base/osint, and the run summary prints the exact tag to pin

The compose deploy step is why a green run would have been misleading: it would have "succeeded" while restarting containers inside a throwaway job pod. Postgres is still never rebuilt unless Dockerfile.pg changes (or rebuild_pg is dispatched).

Dependency

Needs sirius/homek8s PR "ci(forgejo): let the amd64 dind daemon push to the in-cluster registry" merged first — it adds --insecure-registry=forgejo.forgejo.svc.cluster.local:3000 to the amd64 runner's dind daemon. Without it, docker tries HTTPS against the plain-HTTP ClusterIP.

Verification so far

Workflow YAML parsed and every run: script shell-checked (sh -n), with ${{ }} expressions substituted:

name: build-and-deploy | jobs: ['build-push']
runs-on: amd64 | permissions: None
'Plan image builds'                                  sh -n rc=0
'Image refs'                                         sh -n rc=0
'Login to Forgejo registry'                          sh -n rc=0
'Build application image (api / ingester / cameras)' sh -n rc=0
'Build news-scraper image'                           sh -n rc=0
'Build news-summarizer image'                        sh -n rc=0
'Build / refresh Timescale+PostGIS image'            sh -n rc=0
'Summary'                                            sh -n rc=0
ALL OK

Logs from the current-red run and the reachability probes are in the linked homek8s PR.

## Why the build has been red Every failed run since 2026-11-14 (1342 → 1362) dies in ~6 s at **Login to Forgejo registry**, job log (job 2005, run 1362): ``` plan app=1 scraper=1 summarizer=0 pg=0 compose=0 Push registry: 127.0.0.1:3000 Error response from daemon: Get "http://127.0.0.1:3000/v2/": dial tcp 127.0.0.1:3000: connect: connection refused ``` Identical single error in jobs 1986, 2003, 2005. `build.yml` is byte-identical to the last green run (285, 2026-09-01) — nothing in this repo broke it. Forgejo moved out of the Pi's docker into k8s, so inside an in-cluster job pod `127.0.0.1:3000` is the pod's own loopback. The `permissions:` block is **not** the failure: Forgejo ignores job-level `permissions` and only emits a pre-execution warning (*"has a `permissions` field, which is not supported in Forgejo and will be ignored"*). Removing it silences the warning; it does not fix the run. ## What this changes | before | after | |---|---| | `PUSH_REGISTRY: 127.0.0.1:3000` | `forgejo.forgejo.svc.cluster.local:3000` (in-cluster ClusterIP, plain HTTP) | | `runs-on: docker` → matched `pi-arm64` only, built **arm64** images the amd64 cluster can't run | `runs-on: amd64` → `siriussec-amd64`, the node the workloads run on | | `permissions: contents: read / packages: write` | removed (ignored by Forgejo; push uses the `FORGEJO_TOKEN` PAT) | | tags `:latest` + `:<sha12>` | one canonical `amd64-<sha12>` | | "Deploy on runner host (compose)" — ran `docker compose` against the dind daemon, redeploying nothing | dropped; deploys are pinned tags in homek8s `apps/base/osint`, and the run summary prints the exact tag to pin | The compose deploy step is why a green run would have been misleading: it would have "succeeded" while restarting containers inside a throwaway job pod. Postgres is still never rebuilt unless `Dockerfile.pg` changes (or `rebuild_pg` is dispatched). ## Dependency Needs **sirius/homek8s** PR "ci(forgejo): let the amd64 dind daemon push to the in-cluster registry" merged first — it adds `--insecure-registry=forgejo.forgejo.svc.cluster.local:3000` to the amd64 runner's dind daemon. Without it, docker tries HTTPS against the plain-HTTP ClusterIP. ## Verification so far Workflow YAML parsed and every `run:` script shell-checked (`sh -n`), with `${{ }}` expressions substituted: ``` name: build-and-deploy | jobs: ['build-push'] runs-on: amd64 | permissions: None 'Plan image builds' sh -n rc=0 'Image refs' sh -n rc=0 'Login to Forgejo registry' sh -n rc=0 'Build application image (api / ingester / cameras)' sh -n rc=0 'Build news-scraper image' sh -n rc=0 'Build news-summarizer image' sh -n rc=0 'Build / refresh Timescale+PostGIS image' sh -n rc=0 'Summary' sh -n rc=0 ALL OK ``` Logs from the current-red run and the reachability probes are in the linked homek8s PR.
The build has been red since 2026-11-14 (runs 1342+). Every failure is the
registry login step:

  Error response from daemon: Get "http://127.0.0.1:3000/v2/": dial tcp
  127.0.0.1:3000: connect: connection refused

Forgejo moved off the Pi's docker into k8s, so PUSH_REGISTRY=127.0.0.1:3000
was the job pod's own loopback. Point it at the in-cluster service
forgejo.forgejo.svc.cluster.local:3000 (whitelisted insecure on the runner).

Also:
- runs-on amd64 instead of docker: label docker only exists on the arm64 Pi
  runner, whose images the amd64 cluster cannot run.
- drop the job-level permissions block; Forgejo ignores it and flags it with a
  pre-execution warning, which was being read as the cause of the failures.
- drop the compose deploy step: it ran docker compose against the dind daemon,
  redeploying nothing. Deploys are pinned tags in homek8s apps/base/osint; the
  summary now prints the tag to pin.
- tag images amd64-<sha12> (one canonical tag, no :latest drift).
Run 1364 got as far as building and naming the image, then every blob upload
401'd with 'unauthorized: reqPackageAccess'. Forgejo's container routes run
reqPackageAccess(Write), which checks the login token's own scope list for
write:package and rejects a scoped token without it — the token only has to
be scoped, since an unscoped token skips the check. The repo's FORGEJO_TOKEN
secret is such a scoped token.

FORGEJO_/GITHUB_ are reserved secret prefixes, so that name cannot be created
or updated through the API; the workflow now reads REGISTRY_TOKEN instead.
sirius merged commit 5ea43a3d0b into master 2026-11-17 20:10:37 +00:00
Author
Owner

Post-merge verification

sirius/homek8s#15 merged → Flux applied it to the live amd64 runner (dockerd gains --insecure-registry=forgejo.forgejo.svc.cluster.local:3000, amd64.toml gains the docker CLI/cli-plugins bind mounts). Re-dispatched this workflow on master, no manual cluster edits:

run 1367 / job 2010 — success:

plan app=1 scraper=1 summarizer=1 pg=0
Image tag: amd64-5ea43a3d0ba3
Login Succeeded
#14 naming to forgejo.forgejo.svc.cluster.local:3000/sirius/osint-dashboard:amd64-5ea43a3d0ba3        digest: sha256:783bc918...
#15 naming to forgejo.forgejo.svc.cluster.local:3000/sirius/osint-news-scraper:amd64-5ea43a3d0ba3     digest: sha256:009871b4...
#12 naming to forgejo.forgejo.svc.cluster.local:3000/sirius/osint-news-summarizer:amd64-5ea43a3d0ba3  digest: sha256:11adfe96...

Registry confirms all three tags, created 20:16:40–20:16:44Z.

Two things worth knowing for next time:

  • The registry credential had to change. FORGEJO_TOKEN held a scoped PAT without write:package; Forgejo mints a push token regardless and then 401s every blob upload with unauthorized: reqPackageAccess. A new secret REGISTRY_TOKEN (unscoped sirius PAT) replaced it — FORGEJO_/GITHUB_ are reserved prefixes, so that name can't be written through the API. If you'd rather keep least privilege, mint a PAT with just write:package and overwrite REGISTRY_TOKEN.
  • Pushed tags are now amd64-<sha12> only (no :latest). The run summary prints the tag to pin in homek8s apps/base/osint/kustomization.yaml; deploying is still a manifest PR, not this workflow.
### Post-merge verification `sirius/homek8s#15` merged → Flux applied it to the live amd64 runner (dockerd gains `--insecure-registry=forgejo.forgejo.svc.cluster.local:3000`, `amd64.toml` gains the docker CLI/cli-plugins bind mounts). Re-dispatched this workflow on `master`, no manual cluster edits: run **1367** / job 2010 — **success**: ``` plan app=1 scraper=1 summarizer=1 pg=0 Image tag: amd64-5ea43a3d0ba3 Login Succeeded #14 naming to forgejo.forgejo.svc.cluster.local:3000/sirius/osint-dashboard:amd64-5ea43a3d0ba3 digest: sha256:783bc918... #15 naming to forgejo.forgejo.svc.cluster.local:3000/sirius/osint-news-scraper:amd64-5ea43a3d0ba3 digest: sha256:009871b4... #12 naming to forgejo.forgejo.svc.cluster.local:3000/sirius/osint-news-summarizer:amd64-5ea43a3d0ba3 digest: sha256:11adfe96... ``` Registry confirms all three tags, created 20:16:40–20:16:44Z. Two things worth knowing for next time: - The registry credential had to change. `FORGEJO_TOKEN` held a **scoped** PAT without `write:package`; Forgejo mints a push token regardless and then 401s every blob upload with `unauthorized: reqPackageAccess`. A new secret `REGISTRY_TOKEN` (unscoped `sirius` PAT) replaced it — `FORGEJO_`/`GITHUB_` are reserved prefixes, so that name can't be written through the API. If you'd rather keep least privilege, mint a PAT with just `write:package` and overwrite `REGISTRY_TOKEN`. - Pushed tags are now `amd64-<sha12>` only (no `:latest`). The run summary prints the tag to pin in homek8s `apps/base/osint/kustomization.yaml`; deploying is still a manifest PR, not this workflow.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
sirius/osint-dashboard!63
No description provided.