the static-link gate asks the binary, not the build log, because a cache prints nothing
ci / lint the workflow and the shell (push) Successful in 10s
ci / the operator page in a real browser (push) Successful in 2m36s
ci / the same smoke on an image with no base (push) Successful in 4m4s
ci / build the image and smoke it (push) Successful in 4m4s
ci / build, test, smoke (push) Successful in 2m19s

Run 2503 turned a good artifact red: the publish layer was cached, the report
layer was cached with it, the build log carried no report lines, and the gate
that greps that log found nothing to match. The report is now a script
(scripts/aot-link-report.sh) that the build stage copies in and runs, and that CI
runs again with `docker run --entrypoint sh … /report.sh` — a container start is
never cached, so the gate asks the binary. It exits non-zero when the link names
an interpreter or needs a shared object, which is the one claim a scratch layer
depends on.

Verified here: the script prints `binary bytes: 56820992`, `static-pie linked`,
`program headers naming an interpreter: 0`, `NEEDED shared objects: 0`,
`static: no interpreter, no NEEDED shared object`, exit 0 — both as a build step
and as a `docker run`. .dockerignore keeps `scripts/` out of the context and now
makes one named exception for it.
This commit is contained in:
Pavlo Ratushnyi
2026-10-06 09:35:16 +02:00
parent 5278eb4ac2
commit cbafca491b
4 changed files with 74 additions and 20 deletions
+11 -10
View File
@@ -55,19 +55,20 @@ jobs:
fi
[ -S /var/run/docker.sock ] || { echo "no /var/run/docker.sock on this runner"; exit 1; }
- name: Build the AOT image and keep the link report
# Two builds, one cache. The image build produces the artifact; the
# `--target build` build produces the stage that HOLDS the binary, and a
# `docker run` of the report script against it always executes — which is
# what the gate needs, since a cached build layer prints nothing (run 2503
# failed on exactly that).
- name: Build the AOT image and ask the binary whether it is static
run: |
set -eu
docker build -f Dockerfile.aot-probe -t "$IMAGE" --progress=plain . 2>&1 | tee /tmp/aot-build.log
docker build -f Dockerfile.aot-probe -t "$IMAGE" --progress=plain . 2>&1 \
| tail -20
printf 'image size: %s\n' "$(docker image ls --format '{{.Size}}' "$IMAGE")"
# The gate: the two lines the build stage prints about the binary itself.
grep -E 'program headers naming an interpreter: 0$' /tmp/aot-build.log >/dev/null \
|| { echo 'the AOT binary names an interpreter — the link is not static'; exit 1; }
grep -E 'NEEDED shared objects: 0$' /tmp/aot-build.log >/dev/null \
|| { echo 'the AOT binary needs a shared object — the link is not static'; exit 1; }
grep -E 'static-pie linked' /tmp/aot-build.log >/dev/null \
|| { echo 'file(1) does not call this a static-pie executable'; exit 1; }
grep -E 'binary bytes: [0-9]+' /tmp/aot-build.log || true
docker build -f Dockerfile.aot-probe --target build -t openwaf-aot-build:ci . 2>&1 \
| tail -5
docker run --rm --entrypoint sh openwaf-aot-build:ci /report.sh
# Reported, not gated: what the binary does once it is running. It is
# expected to die, and the log line it dies with is the finding.