Files
openwaf/.github/workflows/aot-probe.yml
T
Pavlo Ratushnyi d08ec30e0a
ci / lint the workflow and the shell (push) Successful in 10s
ci / build, test, smoke (push) Failing after 2m11s
ci / the operator page in a real browser (push) Successful in 2m29s
ci / build the image and smoke it (push) Successful in 4m15s
ci / the same smoke on an image with no base (push) Successful in 4m15s
the AOT edge links fully static and dies on sqlite, which names the wall exactly
Dockerfile.aot-probe applies the packaging recipe a neighbouring .NET 10 service
already ships — musl RID, StaticExecutable, StaticOpenSslLinking, IlcSingleThreaded,
scratch plus a CA bundle — and the link claim is checked inside the build rather
than asserted in a comment. Measured here (arm64, native): `file` says
`static-pie linked`, `readelf -l` reports 0 program interpreters, `readelf -d`
reports 0 NEEDED shared objects, the binary is 56,820,992 bytes and the image is
94 MB — against 222 MB for the self-contained scratch image and 262 MB chiseled.

It does not serve, and the reason is one step earlier than the query wall:
`Microsoft.Data.Sqlite.SqliteConnection..cctor` throws `DllNotFoundException:
e_sqlite3` with `Dynamic loading not supported`, because SQLitePCLRaw resolves
sqlite by loading a shared library and a NativeAOT binary has no way to load one.
`scripts/compose-smoke.sh` against that image therefore never gets past
readiness: the container reports exited/unhealthy and every curl answers 000.
Behind that sits the EF precompiler wall measured at 7c5e1ef and today.

So the static scratch shape is reachable for this program and the data layer is
the thing in the way. The deployment that ships it has no EF Core and no SQLite:
Npgsql plus a Roslyn source generator that emits queries at build time
(app/lib/MicroOrm there), which is why its AOT binary can be one static file.

.github/workflows/aot-probe.yml re-runs this on the x86-64 runner weekly and
gates only the static-link claim (0 interpreters, 0 NEEDED, static-pie), because
the musl AOT ILC crashes under emulation on Apple Silicon. docker-compose.aot.yml
runs the production smoke against the probe image for whoever wants the failure
in full rather than summarised.
2026-10-06 09:15:29 +02:00

88 lines
4.5 KiB
YAML

# The NativeAOT relitigation, run on the architecture that ships it.
#
# Not a merge gate. `ci.yml` gates what ships; this one measures what does not
# ship yet, and it is the only place the x86-64 musl AOT build can be produced —
# the musl AOT ILC crashes under emulation on Apple Silicon, so a local build
# can only ever produce the arm64 half of the story.
#
# What it gates, and only this: that the AOT link is FULLY STATIC — no PT_INTERP,
# no NEEDED shared object — because that is the claim `Dockerfile.aot-probe`
# makes and the claim a scratch image depends on. A build that links against a
# shared libc would still produce a bootable-looking image and a silently
# different artifact.
#
# What it reports without gating: that the binary then refuses to start, because
# SQLitePCLRaw resolves libe_sqlite3 by dynamic loading and NativeAOT says
# "Dynamic loading not supported". Behind that wall sits the next one — EF's
# precompile-queries generator (docs/ARCHITECTURE.md, NativeAOT entry). Both are
# recorded here rather than argued, and both are why the shipped images are the
# chiseled and the self-contained-scratch ones.
name: aot-probe
on:
schedule:
- cron: '17 4 * * 1'
workflow_dispatch:
env:
IMAGE: openwaf-aot-probe:ci
jobs:
aot:
name: the static musl link, on x86-64
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- name: Install Docker CLI + compose plugin
run: |
set -eu
if command -v docker >/dev/null 2>&1; then
echo "docker already present: $(docker --version)"
else
export DEBIAN_FRONTEND=noninteractive
apt-get update -qq
apt-get install -qq -y ca-certificates curl gnupg >/dev/null
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg \
| gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian bookworm stable" \
> /etc/apt/sources.list.d/docker.list
apt-get update -qq
apt-get install -qq -y docker-ce-cli docker-compose-plugin docker-buildx-plugin >/dev/null
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
run: |
set -eu
docker build -f Dockerfile.aot-probe -t "$IMAGE" --progress=plain . 2>&1 | tee /tmp/aot-build.log
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
# 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.
- name: Start it and record what it says
run: |
set -uo pipefail
docker run -d --name aotprobe -p 18099:8080 \
-e OPENWAF_ADMIN_TOKEN=ci-only-throwaway \
-e ReverseProxy__Clusters__upstream__Destinations__upstream1__Address=http://127.0.0.1:1/ \
"$IMAGE" >/dev/null
sleep 20
docker inspect --format 'container state: {{.State.Status}} health: {{if .State.Health}}{{.State.Health.Status}}{{else}}no healthcheck{{end}}' aotprobe
docker logs aotprobe 2>&1 | grep -m1 -E 'Hosting failed to start|unable to start|DllNotFoundException|Dynamic loading not supported|queries refused' \
|| echo 'no startup failure line found — that would be news worth reading'
docker logs aotprobe 2>&1 | grep -c "Query wasn't precompiled and dynamic code isn't supported with NativeAOT" \
| sed 's/^/queries refused at run time: /'
docker rm -f aotprobe >/dev/null 2>&1