Every gate this workflow runs now has a Linux number except one

`scripts/ci-linux-rehearsal.sh` (added in `42d4af9`) covered the dotnet suites
and `smoke.sh`. The third thing the objective asks CI to run — `scripts/
compose-smoke.sh` — did not have a Linux number, and "we run it on macOS against
a Linux image" is only half a proof: the script itself is the part that could be
a darwin habit.

It now runs in `docker:cli` against the host daemon, so the image build, the
stack and the asserting shell are all Linux. Full rehearsal, one invocation:

    source gates (restore/build/unit/integration/smoke): PASS   54/54, 28/28, 19/19
    compose gate: PASS                                          27 passed, 0 failed
    console gate: not covered here (needs a real Chromium)
    wall: 47.61 s

Getting it green surfaced two facts about the harness, not the product, and both
are now comments in the script where the next person will hit them:

- `compose-smoke.sh` asserts over JSON with **python3** (`jcount`/`jget`) and
  reads the clock with it. A bare container failed **23 of 27** assertions for
  nothing else. The runner image has python3; `docker:cli` does not, so the
  stage installs bash, curl and python3 itself.
- The stack is created by the host daemon, so its published port lives in the
  host's network namespace. Without `EDGE=http://host.docker.internal:8080`,
  every HTTP assertion returns curl code `000` **while the image's own
  HEALTHCHECK reports healthy** — a green stack with red assertions, the most
  confusing failure this gate can produce. The gate already had an `EDGE`
  override; this is what it is for.

The compose stage also printed its own instrumentation again: enforcement lag
**12 ms** between writing a ban and the edge refusing the source — the snapshot
invalidation path, measured on Linux this time.

Still true and still said plainly: none of these jobs has executed on a runner,
because the repository has no remote. The Linux numbers narrow what a first run
could still discover; they do not replace one.
This commit is contained in:
Pavlo Ratushnyi
2026-10-01 15:31:16 +02:00
parent bf1129a8d8
commit c290aa06f6
3 changed files with 146 additions and 68 deletions
+115 -46
View File
@@ -6,63 +6,132 @@
# passes on darwin and fails on linux is not a gate, it is a local habit. This
# script closes the part of the gap that can be closed at a desk.
#
# scripts/ci-linux-rehearsal.sh # restore, build, unit, integration, smoke
# LINUX_IMAGE=… scripts/ci-linux-rehearsal.sh
# scripts/ci-linux-rehearsal.sh # source gates, then the compose gate
# scripts/ci-linux-rehearsal.sh source # restore, build, unit, integration, smoke
# scripts/ci-linux-rehearsal.sh compose # compose-smoke against the host daemon
#
# What it does NOT cover, and why: compose-smoke needs a docker daemon inside
# the container (the runner has one natively), and the console gate needs a real
# Chromium. Those two stay macOS-verified until the workflow runs somewhere that
# has both.
#
# The tree is copied, not mounted: Linux-built binaries landing in a macOS
# working tree make the next local `--no-build` run try to exec an ELF binary.
# Covered: the dotnet suites and smoke.sh (Ubuntu 24.04, the same SDK family the
# runner installs) and compose-smoke.sh (Alpine container, linux image build,
# the host daemon doing the work). Not covered: the console gate, which needs a
# real Chromium — that one stays macOS-verified until this workflow actually
# executes somewhere that has one.
set -euo pipefail
cd "$(dirname "$0")/.."
IMAGE=${LINUX_IMAGE:-mcr.microsoft.com/dotnet/sdk:10.0}
WORK=$(mktemp -d /tmp/openwaf-linux.XXXXXX)
trap 'rm -rf "$WORK"' EXIT
STAGE=${1:-all}
SOURCE_IMAGE=${SOURCE_IMAGE:-mcr.microsoft.com/dotnet/sdk:10.0}
COMPOSE_IMAGE=${COMPOSE_IMAGE:-docker:cli}
DOCKER_SOCKET=${DOCKER_SOCKET:-/var/run/docker.sock}
OPENWAF_ADMIN_TOKEN=${OPENWAF_ADMIN_TOKEN:-ci-only-throwaway}
export OPENWAF_ADMIN_TOKEN DOTNET_CLI_TELEMETRY_OPTOUT=1 DOTNET_NOLOGO=1
echo "copying the tree (no .git, no build output) into $WORK"
tar --exclude='./.git' --exclude='bin' --exclude='obj' -cf - . | tar -xf - -C "$WORK"
source_status=0
compose_status=0
compose_ran=0
echo "image: $IMAGE"
status=0
docker run --rm \
-v "$WORK:/src" -w /src \
-e DOTNET_CLI_TELEMETRY_OPTOUT=1 -e DOTNET_NOLOGO=1 \
"$IMAGE" bash -euo pipefail -c '
echo "== what the container is =="
uname -srm
grep -m1 PRETTY_NAME /etc/os-release
cd dotnet && echo "sdk resolving global.json: $(dotnet --version)" && cd ..
if [ "$STAGE" = all ] || [ "$STAGE" = source ]; then
WORK=$(mktemp -d /tmp/openwaf-linux.XXXXXX)
trap 'rm -rf "$WORK"' EXIT
echo "copying the tree (no .git, no build output) into $WORK"
# A copy, not a mount: Linux-built binaries landing in a macOS working tree
# make the next local `--no-build` try to exec an ELF file.
tar --exclude='./.git' --exclude='bin' --exclude='obj' -cf - . | tar -xf - -C "$WORK"
echo "== gate: restore =="
dotnet restore dotnet/OpenWaf.slnx
echo "== source gates in $SOURCE_IMAGE =="
docker run --rm -v "$WORK:/src" -w /src \
-e DOTNET_CLI_TELEMETRY_OPTOUT=1 -e DOTNET_NOLOGO=1 \
"$SOURCE_IMAGE" bash -euo pipefail -c '
echo "-- what the container is --"
uname -srm
grep -m1 PRETTY_NAME /etc/os-release
cd dotnet && echo "sdk resolving global.json: $(dotnet --version)" && cd ..
echo "== gate: build (TreatWarningsAsErrors) =="
dotnet build dotnet/OpenWaf.slnx -c Release --no-restore
echo "== gate: restore =="
dotnet restore dotnet/OpenWaf.slnx
echo "== gate: unit =="
dotnet test dotnet/OpenWaf.Tests.Unit/OpenWaf.Tests.Unit.csproj -c Release --no-build
echo "== gate: build (TreatWarningsAsErrors) =="
dotnet build dotnet/OpenWaf.slnx -c Release --no-restore
echo "== gate: integration =="
dotnet test dotnet/OpenWaf.Tests.Integration/OpenWaf.Tests.Integration.csproj -c Release --no-build
echo "== gate: unit =="
dotnet test dotnet/OpenWaf.Tests.Unit/OpenWaf.Tests.Unit.csproj -c Release --no-build
# The smoke script uses `python3 -m http.server` as the upstream it knows
# nothing about. The runner image has python3; the dotnet sdk image does
# not, so install it here rather than skip the gate.
echo "== python3 for the smoke upstream =="
command -v python3 || { apt-get update -qq && apt-get install -y -qq python3 >/dev/null; }
python3 --version
echo "== gate: integration =="
dotnet test dotnet/OpenWaf.Tests.Integration/OpenWaf.Tests.Integration.csproj -c Release --no-build
echo "== gate: smoke =="
./scripts/smoke.sh
' || status=$?
if [ "$status" -eq 0 ]; then
printf '\nlinux rehearsal passed: restore, build, unit, integration, smoke on %s\n' "$IMAGE"
else
printf '\nlinux rehearsal FAILED (exit %s) — this is exactly what the first CI run would have hit\n' "$status"
# smoke.sh uses `python3 -m http.server` as the upstream it knows nothing
# about. The runner image has python3; the dotnet sdk image does not.
echo "== python3 for the smoke upstream =="
command -v python3 || { apt-get update -qq && apt-get install -y -qq python3 >/dev/null; }
python3 --version
echo "== gate: smoke =="
./scripts/smoke.sh
' || source_status=$?
fi
exit "$status"
if [ "$STAGE" = all ] || [ "$STAGE" = compose ]; then
if [ ! -S "$DOCKER_SOCKET" ]; then
echo "compose stage SKIPPED: no docker socket at $DOCKER_SOCKET"
else
compose_ran=1
echo "== compose gate in $COMPOSE_IMAGE, driven by the host daemon =="
# The repo is mounted at the SAME absolute path it has on the host, because
# the daemon that builds the image resolves the build context on its own
# side of the mount: a different path inside the container would send
# `compose build` looking for a context that does not exist there.
# docker:cli ships no bash and no curl, both of which the gate uses, so the
# container adds them itself.
# The stack is created by the host daemon, so its published port lives in
# the host's namespace, not this container's: the first run of this stage
# reached the docker API fine (the image's own HEALTHCHECK assertion passed)
# and got curl code 000 on every HTTP assertion, because 127.0.0.1 inside
# the container is the container. EDGE is the gate's own override for
# exactly this, pointed at the gateway.
docker run --rm \
-v "$PWD:$PWD" -w "$PWD" \
-v "$DOCKER_SOCKET:/var/run/docker.sock" \
--add-host=host.docker.internal:host-gateway \
-e OPENWAF_ADMIN_TOKEN \
-e EDGE="${EDGE:-http://host.docker.internal:8080}" \
"$COMPOSE_IMAGE" sh -euo pipefail -c '
echo "-- what the container is --"
uname -srm 2>/dev/null || grep -m1 NAME /etc/os-release
docker --version
docker compose version
# compose-smoke.sh asserts over JSON with python3 (jcount/jget) and
# reads the clock with it; the first Linux run of this stage failed 23
# of 27 assertions for nothing but a missing python3. The runner image
# has python3; a bare container does not.
command -v bash >/dev/null || apk add --no-cache bash >/dev/null
command -v curl >/dev/null || apk add --no-cache curl >/dev/null
command -v python3 >/dev/null || apk add --no-cache python3 >/dev/null
echo "== gate: compose-smoke =="
bash ./scripts/compose-smoke.sh
' || compose_status=$?
fi
fi
if [ "$STAGE" = compose ]; then
source_verdict='not run'
elif [ "$source_status" -eq 0 ]; then
source_verdict='PASS'
else
source_verdict="FAIL ($source_status)"
fi
if [ "$compose_ran" -eq 0 ]; then
compose_verdict='skipped (no docker socket)'
elif [ "$compose_status" -eq 0 ]; then
compose_verdict='PASS'
else
compose_verdict="FAIL ($compose_status)"
fi
echo
echo '== rehearsal summary =='
printf ' source gates (restore/build/unit/integration/smoke): %s\n' "$source_verdict"
printf ' compose gate: %s\n' "$compose_verdict"
printf ' console gate: not covered here (needs a real Chromium)\n'
[ "$source_status" -eq 0 ] && [ "$compose_status" -eq 0 ]