Compare commits

..
Author SHA1 Message Date
agent b26acb5dfd probe: stop filtering away the RUN output
The probe kept succeeding while its results vanished: the grep -vE plus tail -40
dropped the buildkit progress lines that carry the actual curl output. Keep the
full log, then print only the RUN lines with their #N prefix stripped.
2026-08-31 14:51:14 +02:00
agent c3989179ad probe: repair the buildctl invocation after a bad sed 2026-08-31 14:39:10 +02:00
agent d2b516b83b probe: drop type=cacheonly, this buildkit has no such exporter
buildctl reported: exporter "cacheonly" could not be found. Omitting --output
still runs every RUN step, which is all the probe needs. Same defect exists in
build-image-gitea.yml (validation path and toolchain assertion) and needs its
own fix.
2026-08-31 14:38:57 +02:00
agent c0d4f92ca1 probe: run the same probes from buildkitd network position
The runner-pod probe cannot be transferred to buildkitd: different namespace,
different NetworkPolicies, so an UNREACHABLE there may be policy rather than
routing. This curls through a buildctl build, which egresses from the buildkitd
pod that actually has to push.
2026-08-31 14:32:10 +02:00
agent 09bcc8fa9b probe: measure which registry endpoints a cluster pod can reach
Temporary, not for merge. 10.40.0.10 is the istio-gateway EXTERNAL LoadBalancer
address and is connection-refused from the pod network; this measures the
candidates instead of inferring one.
2026-08-31 14:30:50 +02:00
markus 86cb6540bb ci: build this image on Gitea via the in-cluster buildkitd (#7)
build image (gitea) / build (push) Failing after 12s
2026-08-31 11:06:12 +00:00
agent 2d08b79be7 ci: build this image on Gitea via the in-cluster buildkitd
build-image.yml is GitHub-only, so the image the Gitea runners are built FROM
could only be produced by GitHub. When GitHub Actions went unavailable on
2026-08-29 that circularity bit: the fix for openssl/jq missing from this image
— the absence that blocked v0.0.134 and v0.0.135 — could not be published on the
forge the project is moving to.

This publishes from the self-hosted runners through the in-cluster rootless
buildkitd, the path zegit images already use. buildah needing user namespaces
does not apply: buildkitd is a separate hardened workload and the job only
speaks to it over the network, so nothing is built inside the runner container.

Same contract as build-image.yml: a master push validates both arches and
publishes nothing, only an explicit dispatch names a tag and pushes, and a
dispatch without a package-write token fails loudly instead of reporting success
having pushed nothing.

The toolchain assertion is kept but done with buildkit rather than docker run,
which these runners lack: a stage FROM the published image whose RUN fails on a
missing tool, built natively for both arches. Verified it passes against an
image built from current master and fails with MISSING: openssl against the
deployed ci5.
2026-08-31 13:04:45 +02:00
markus d5ab7a483e Merge pull request 'fix: bake openssl and jq into the runner image, and assert them' (#6) from claude/fix/add-jq-and-openssl into master
build image / build (push) Skipped
Reviewed-on: #6
2026-08-31 10:57:42 +00:00
agent bc1d6890b6 fix: bake openssl and jq into the runner image, and assert them
The release tag gate parses the Control Plane quorum verdict and verifies its
Ed25519 DSSE signature by shelling out to jq and openssl. Neither is in this
image, and both call sites read cmd ... || { echo <security message>; exit 1; },
so command-not-found took the failure branch: the gate reported a valid, signed
approval first as "not a signed DSSE envelope" and then as "signature FAILED
verification". That blocked v0.0.134 and v0.0.135 on 2026-08-31 and pointed the
investigation at the Tag Request rather than at this image — the same shape as
the git-daemon gap already documented above the package list.

Also adds both to the toolchain assertion. That check already existed and still
missed them, because it only covers what someone thought to list; the comment
now says so, and says to extend it whenever a gate grows a shell dependency.

Verified by building this image and running the gate script inside it against
the live Control Plane: openssl 3.5.8, jq 1.8.1, and the v0.0.135 verdict
verifies and binds to its commit. The unpatched image fails the same script.
2026-08-31 12:56:44 +02:00
markus bf26dc4e15 Merge pull request 'ci: assert the published image still contains the toolchain the gates need' (#5) from claude/ci/assert-image-contents into master
build image / build (push) Skipped
Reviewed-on: #5
2026-08-20 14:22:27 +00:00
markus d0b0bbf239 Merge pull request 'fix: restore gcc, musl-dev, python3 and py3-yaml to the image' (#4) from claude/fix/restore-toolchain into master
build image / build (push) Skipped
Reviewed-on: #4
2026-08-20 14:03:55 +00:00
agent 5427ccbad2 fix: restore gcc, musl-dev, python3 and py3-yaml to the image
REGRESSION, mine. The committed Dockerfile had drifted from the image actually
in service: the running ci3 image contained these four packages, the Dockerfile
did not, and I rebuilt ci4 from the Dockerfile. The rollout therefore removed
tools zegit's CI depends on.

Proof the deployed ci3 had them: its Gitea runs got PAST `make credentials-check`
— which shells out to python3 — and failed later at cover-check. The ci4 run
fails earlier, at `credentials-coverage: need python3`.

What each is for, so the next rebuild does not drop them again:
  python3, py3-yaml  the repo's own gates are Python — credentials-coverage.sh,
                     validate-admission.sh and feature-lint.sh all shell out to
                     it, and credentials-coverage parses manifests with yaml
  gcc, musl-dev      cgo, which `go test -race` in the Makefile test target
                     requires: a C compiler plus libc headers (musl on Alpine)

Verified on the real base image rather than assumed — on
code.forgejo.org/forgejo/runner:12.11.1, `apk add git git-daemon gcc musl-dev
python3 py3-yaml` yields Python 3.12.14, a working `import yaml`, gcc 15.2.0,
and git-http-backend on the git exec path.

The deeper lesson is that a hand-built image can drift from its Dockerfile
silently, and nothing notices until someone rebuilds. Publishing via CI (#2)
is what stops that recurring, since every future image comes from the
committed file.
2026-08-20 15:53:23 +02:00
5 changed files with 316 additions and 1 deletions

No files matched your search

+167
View File
@@ -0,0 +1,167 @@
name: build image (gitea)
# Publishes the runner toolchain image from the SELF-HOSTED Gitea runners, via
# the in-cluster rootless buildkitd — the same path zegit's own images already
# use (zegit .github/workflows/image-gitea.yml).
#
# Why this exists alongside build-image.yml: that workflow is GitHub-only, so
# the image the Gitea runners are BUILT FROM could only be produced by GitHub.
# When GitHub Actions became unavailable on 2026-08-29 that circularity bit —
# the fix for a missing tool in this very image (openssl/jq, whose absence
# blocked v0.0.134 and v0.0.135) could not be published on the forge the project
# is moving to. This removes the dependency.
#
# build-image.yml's header says the runners cannot build images because rootless
# buildah needs user namespaces the pod does not have. That is true of buildah
# IN THE JOB, and irrelevant here: buildkitd is its own hardened workload in
# buildkit-system, and this job only speaks to it over the network with
# buildctl. Nothing is built inside the runner container.
on:
workflow_dispatch:
inputs:
tag:
description: 'Image tag, e.g. 12.11.1-ci6 (upstream runner version + ci revision)'
required: true
type: string
push:
branches: [master]
paths:
- 'Dockerfile'
- '.github/workflows/build-image-gitea.yml'
env:
BUILDKIT_HOST: tcp://buildkitd.buildkit-system.svc.cluster.local:1234
BUILDKIT_VERSION: v0.32.2
REGISTRY: gitea.langenoja.se
IMAGE_PATH: zegit-zoo/zegit-forgejo-runner
jobs:
build:
# Gitea-only: buildkitd is an in-cluster service that GitHub runners cannot
# reach. build-image.yml still covers the GitHub/ghcr.io side.
if: ${{ github.server_url != 'https://github.com' }}
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
# Workspace-local because the runner is non-root and cannot write to
# /usr/local/bin. The smoke test uses the FULL PATH deliberately:
# $GITHUB_PATH only takes effect for SUBSEQUENT steps, so a bare
# `buildctl --version` here would be command-not-found.
- name: Install buildctl
run: |
set -euo pipefail
case "$(uname -m)" in
x86_64) arch=amd64;;
aarch64) arch=arm64;;
*) echo "::error::unsupported arch $(uname -m)"; exit 1;;
esac
mkdir -p "$GITHUB_WORKSPACE/.bin"
curl -fsSL "https://github.com/moby/buildkit/releases/download/${BUILDKIT_VERSION}/buildkit-${BUILDKIT_VERSION}.linux-${arch}.tar.gz" \
| tar -xz -C "$GITHUB_WORKSPACE/.bin" --strip-components=1 bin/buildctl
echo "$GITHUB_WORKSPACE/.bin" >> "$GITHUB_PATH"
"$GITHUB_WORKSPACE/.bin/buildctl" --version
- name: buildkitd reachable
run: buildctl debug workers
# A master push VALIDATES that the Dockerfile still builds on both arches
# but publishes nothing; only an explicit dispatch names a tag and pushes.
# Guessing a tag from a branch push would silently mint versions.
- id: meta
run: |
set -euo pipefail
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "push=true" >> "$GITHUB_OUTPUT"
echo "tag=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
else
echo "push=false" >> "$GITHUB_OUTPUT"
echo "tag=ci-validation" >> "$GITHUB_OUTPUT"
fi
# Refuse a publish that cannot complete, rather than reporting success
# having pushed nothing. A validation run needs no credentials.
# The Gitea Actions token cannot write packages; this needs an explicit
# package-write PAT (read:package is pull-only).
- name: Registry login
if: ${{ steps.meta.outputs.push == 'true' }}
env:
TOKEN: ${{ secrets.ZEGIT_PACKAGE_TOKEN }}
run: |
set -euo pipefail
if [ -z "${TOKEN:-}" ]; then
echo "::error::ZEGIT_PACKAGE_TOKEN is not set, so this dispatch would build an image and push nothing. Issue a package-write token and store it as this secret."
exit 1
fi
mkdir -p "$HOME/.docker"
printf '{"auths":{"%s":{"auth":"%s"}}}\n' \
"$REGISTRY" "$(printf 'zegit-zoo:%s' "$TOKEN" | base64 -w0)" \
> "$HOME/.docker/config.json"
- name: Build multi-arch
run: |
set -euo pipefail
REF="${REGISTRY}/${IMAGE_PATH}:${{ steps.meta.outputs.tag }}"
if [ "${{ steps.meta.outputs.push }}" = "true" ]; then
out="type=image,name=${REF},push=true"
else
out="type=cacheonly"
fi
buildctl build --progress=plain \
--frontend dockerfile.v0 \
--local context=. \
--local dockerfile=. \
--opt platform=linux/amd64,linux/arm64 \
--output "$out"
# The image is a TOOLCHAIN, so "it built" is not the property that matters
# — "it still contains what the gates shell out to" is. build-image.yml
# asserts that with `docker run`, which does not exist on these runners;
# buildkit can do it directly by building a stage FROM the published image
# whose RUN fails when a tool is absent. That is strictly better: buildkit
# runs it natively per platform, so a package that resolves on amd64 but
# not on arm64 cannot reach half the nodes unnoticed.
#
# openssl and jq are on this list because their absence blocked v0.0.134
# and v0.0.135: the release tag gate shells out to both to verify the
# Control Plane's signed quorum verdict, and a missing tool was reported
# as "verdict not signed" and "signature FAILED verification" — a tooling
# gap narrated as a security verdict. Extend this list whenever a gate
# grows a shell dependency; it only covers what someone remembered to add.
- name: Assert the published image carries the toolchain the gates need
if: ${{ steps.meta.outputs.push == 'true' }}
run: |
set -euo pipefail
REF="${REGISTRY}/${IMAGE_PATH}:${{ steps.meta.outputs.tag }}"
work=$(mktemp -d)
{
echo "FROM ${REF}"
echo 'RUN set -eu; \'
echo ' python3 -c "import yaml, sys; print(\"python3+yaml\", sys.version.split()[0])"; \'
echo ' for t in gcc node bash make curl tar openssl jq; do \'
echo ' command -v "$t" >/dev/null || { echo "MISSING: $t" >&2; exit 1; }; \'
echo ' echo "ok: $t"; \'
echo ' done; \'
echo ' test -x "$(git --exec-path)/git-http-backend" || { echo "MISSING: git-http-backend" >&2; exit 1; }; \'
echo ' echo "ok: git-http-backend"'
} > "$work/Dockerfile"
cat "$work/Dockerfile"
buildctl build --progress=plain \
--frontend dockerfile.v0 \
--local context="$work" \
--local dockerfile="$work" \
--opt platform=linux/amd64,linux/arm64 \
--output type=cacheonly
echo "✓ toolchain intact on linux/amd64 and linux/arm64"
- name: Summary
run: |
if [ "${{ steps.meta.outputs.push }}" = "true" ]; then
echo "published ${REGISTRY}/${IMAGE_PATH}:${{ steps.meta.outputs.tag }} (amd64+arm64), toolchain asserted on both"
else
echo "validation only — the Dockerfile builds on both arches; nothing published"
fi
+10
View File
@@ -101,6 +101,14 @@ jobs:
# #
# Asserted on BOTH architectures, because a package that resolves on amd64 # Asserted on BOTH architectures, because a package that resolves on amd64
# and not on arm64 would otherwise reach half the nodes unnoticed. # and not on arm64 would otherwise reach half the nodes unnoticed.
#
# openssl and jq were added after this check already existed and still
# missed them: the release tag gate shells out to both to verify the
# Control Plane's signed quorum verdict, and their absence surfaced as
# "verdict not signed" / "signature FAILED verification" rather than as a
# missing tool, blocking v0.0.134 and v0.0.135. The list only covers what
# someone remembered to add, so add to it whenever a gate grows a new
# shell dependency.
- name: Verify the image still contains the toolchain the gates need - name: Verify the image still contains the toolchain the gates need
if: ${{ steps.meta.outputs.push == 'true' }} if: ${{ steps.meta.outputs.push == 'true' }}
run: | run: |
@@ -119,6 +127,8 @@ jobs:
command -v make >/dev/null && echo "make=ok" || echo "make=MISSING" command -v make >/dev/null && echo "make=ok" || echo "make=MISSING"
command -v curl >/dev/null && echo "curl=ok" || echo "curl=MISSING" command -v curl >/dev/null && echo "curl=ok" || echo "curl=MISSING"
command -v tar >/dev/null && echo "tar=ok" || echo "tar=MISSING" command -v tar >/dev/null && echo "tar=ok" || echo "tar=MISSING"
command -v openssl >/dev/null && echo "openssl=ok" || echo "openssl=MISSING"
command -v jq >/dev/null && echo "jq=ok" || echo "jq=MISSING"
[ -x "$(git --exec-path)/git-http-backend" ] \ [ -x "$(git --exec-path)/git-http-backend" ] \
&& echo "git-http-backend=ok" || echo "git-http-backend=MISSING" && echo "git-http-backend=ok" || echo "git-http-backend=MISSING"
' 2>&1) || { echo "::error::could not run $REF on $plat"; fail=1; continue; } ' 2>&1) || { echo "::error::could not run $REF on $plat"; fail=1; continue; }
+66
View File
@@ -0,0 +1,66 @@
name: probe registry from buildkitd
# TEMPORARY probe branch — not for merge.
#
# The first probe ran in the RUNNER pod. buildkitd is a different pod in a
# different namespace with its own NetworkPolicies, so those results cannot be
# transferred: an UNREACHABLE there may be the runner's policy, not routing.
# This runs the same probes THROUGH buildkitd, by building a stage whose RUN
# does the curling — that egresses from the buildkitd pod, which is the network
# position that actually has to push.
#
# It prints results and always exits 0: this is a measurement, not a gate.
on:
workflow_dispatch:
env:
BUILDKIT_HOST: tcp://buildkitd.buildkit-system.svc.cluster.local:1234
BUILDKIT_VERSION: v0.32.2
jobs:
probe:
if: ${{ github.server_url != 'https://github.com' }}
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Install buildctl
run: |
set -euo pipefail
case "$(uname -m)" in x86_64) arch=amd64;; aarch64) arch=arm64;; *) exit 1;; esac
mkdir -p "$GITHUB_WORKSPACE/.bin"
curl -fsSL "https://github.com/moby/buildkit/releases/download/${BUILDKIT_VERSION}/buildkit-${BUILDKIT_VERSION}.linux-${arch}.tar.gz" \
| tar -xz -C "$GITHUB_WORKSPACE/.bin" --strip-components=1 bin/buildctl
echo "$GITHUB_WORKSPACE/.bin" >> "$GITHUB_PATH"
"$GITHUB_WORKSPACE/.bin/buildctl" --version
- name: Probe from inside buildkitd
run: |
set -euo pipefail
work=$(mktemp -d)
{
echo 'FROM alpine:3.20'
echo 'RUN apk add --no-cache curl >/dev/null 2>&1 || true'
echo 'RUN set -u; \'
echo ' f="http=%{http_code} tls=%{ssl_verify_result} t=%{time_total}\\n"; \'
echo ' echo "== public name via cluster DNS =="; \'
echo ' curl -s -o /dev/null -w "$f" --max-time 8 https://gitea.langenoja.se/v2/ || echo UNREACHABLE; \'
echo ' echo "== resolves to =="; getent hosts gitea.langenoja.se || echo "(none)"; \'
echo ' echo "== istio-gateway external lb 10.40.0.10 =="; \'
echo ' curl -s -o /dev/null -w "$f" --max-time 8 --resolve gitea.langenoja.se:443:10.40.0.10 https://gitea.langenoja.se/v2/ || echo UNREACHABLE; \'
echo ' echo "== istio-gateway clusterip 10.43.1.114 =="; \'
echo ' curl -s -o /dev/null -w "$f" --max-time 8 --resolve gitea.langenoja.se:443:10.43.1.114 https://gitea.langenoja.se/v2/ || echo UNREACHABLE; \'
echo ' echo "== gitea http service in-cluster =="; \'
echo ' curl -s -o /dev/null -w "$f" --max-time 8 http://gitea-system-gitea-http.gitea-system.svc.cluster.local:3000/v2/ || echo UNREACHABLE; \'
echo ' echo "== gitea http service, headers =="; \'
echo ' curl -s -D- -o /dev/null --max-time 8 http://gitea-system-gitea-http.gitea-system.svc.cluster.local:3000/v2/ | head -5 || true'
} > "$work/Dockerfile"
cat "$work/Dockerfile"
buildctl build --progress=plain \
--frontend dockerfile.v0 \
--local context="$work" \
--local dockerfile="$work" \
--opt platform=linux/amd64 2>&1 | tee /tmp/probe.log | tail -80
echo "=== PROBE RESULTS ==="
grep -E "^#[0-9]+ [0-9.]+ " /tmp/probe.log | sed -E "s/^#[0-9]+ [0-9.]+ //" || echo "(no RUN output captured)"
echo "probe finished (results above, from buildkitd's network position)"
+47
View File
@@ -0,0 +1,47 @@
name: probe registry endpoints
# TEMPORARY probe branch — not for merge. Answers one question with evidence
# instead of inference: which registry endpoints are reachable from a pod inside
# this cluster, after 10.40.0.10 (the istio-gateway LoadBalancer EXTERNAL
# address) turned out to be connection-refused from the pod network while
# answering fine from a LAN workstation.
on:
workflow_dispatch:
jobs:
probe:
if: ${{ github.server_url != 'https://github.com' }}
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Probe candidate registry endpoints
run: |
set -u
fmt='http=%{http_code} tls=%{ssl_verify_result} t=%{time_total}\n'
echo "--- public name via cluster DNS (the path that works today) ---"
printf '%-46s ' 'gitea.langenoja.se:443'
curl -s -o /dev/null -w "$fmt" --max-time 8 https://gitea.langenoja.se/v2/ \
|| echo "UNREACHABLE"
echo "--- istio-gateway EXTERNAL lb ip (what #949 pinned) ---"
printf '%-46s ' '10.40.0.10:443'
curl -s -o /dev/null -w "$fmt" --max-time 8 \
--resolve gitea.langenoja.se:443:10.40.0.10 https://gitea.langenoja.se/v2/ \
|| echo "UNREACHABLE"
echo "--- istio-gateway CLUSTER ip (candidate) ---"
printf '%-46s ' '10.43.1.114:443'
curl -s -o /dev/null -w "$fmt" --max-time 8 \
--resolve gitea.langenoja.se:443:10.43.1.114 https://gitea.langenoja.se/v2/ \
|| echo "UNREACHABLE"
echo "--- gitea http service, in-cluster, plain http ---"
printf '%-46s ' 'gitea-system-gitea-http:3000'
curl -s -o /dev/null -w "$fmt" --max-time 8 \
http://gitea-system-gitea-http.gitea-system.svc.cluster.local:3000/v2/ \
|| echo "UNREACHABLE"
echo "--- what this pod resolves the public name to ---"
getent hosts gitea.langenoja.se || echo "(getent failed)"
+26 -1
View File
@@ -38,6 +38,25 @@ USER root
# curl,tar -> setup-go / gitleaks download + extract their own arch-specific binaries # curl,tar -> setup-go / gitleaks download + extract their own arch-specific binaries
# make -> zegit Makefile targets # make -> zegit Makefile targets
# ca-certificates -> trusted roots for HTTPS to gitea/github/goproxy # ca-certificates -> trusted roots for HTTPS to gitea/github/goproxy
# openssl -> the release tag gate verifies the Control Plane's SIGNED quorum
# verdict (Ed25519 DSSE) with `openssl pkeyutl -verify -rawin`.
# Absent, that command failed "command not found" and the gate's
# `|| { echo ...; exit 1; }` reported it as "Quorum verdict
# signature FAILED verification" -- a TOOLING gap narrated as a
# SECURITY verdict, pointing the investigation at a perfectly
# valid signed approval instead of at this image. It blocked
# v0.0.134 and v0.0.135 on 2026-08-31.
# jq -> the same story one step earlier: the gate parsed that envelope
# with `jq -e`, and a missing jq was reported as "not a signed
# DSSE envelope". jq is the reflex tool for JSON in shell steps,
# so its absence keeps resurfacing as a misleading failure in
# whichever step reaches for it next.
# gcc,musl-dev -> C toolchain for cgo; `go test -race` (the Makefile test
# target) requires cgo, which needs a C compiler + libc headers
# (musl on Alpine)
# python3,py3-yaml -> the repo's own gates are Python: credentials-coverage.sh,
# validate-admission.sh and feature-lint.sh all shell out to
# python3, and credentials-coverage parses manifests with yaml
# #
# Go is intentionally NOT baked in: actions/setup-go fetches the pinned version # Go is intentionally NOT baked in: actions/setup-go fetches the pinned version
# per-run (node + tar are present), so the image needs no rebuild on Go bumps. # per-run (node + tar are present), so the image needs no rebuild on Go bumps.
@@ -50,7 +69,13 @@ RUN apk add --no-cache \
curl \ curl \
tar \ tar \
make \ make \
ca-certificates ca-certificates \
gcc \
musl-dev \
python3 \
py3-yaml \
openssl \
jq
# Match the runner pod's runAsUser (1000); keep the image non-root by default. # Match the runner pod's runAsUser (1000); keep the image non-root by default.
USER 1000 USER 1000