From c290aa06f6bb0ef751a27de7b562787d5ba4f122 Mon Sep 17 00:00:00 2001 From: Pavlo Ratushnyi Date: Thu, 1 Oct 2026 15:31:16 +0200 Subject: [PATCH] Every gate this workflow runs now has a Linux number except one MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `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. --- .github/workflows/ci.yml | 16 ++-- README.md | 37 +++++--- scripts/ci-linux-rehearsal.sh | 161 ++++++++++++++++++++++++---------- 3 files changed, 146 insertions(+), 68 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 59723d8..f4a3aff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,14 +14,14 @@ # a single apt-get step; a hung job is worse than a failed one. # # What has been done to narrow the darwin/linux gap without a runner: -# scripts/ci-linux-rehearsal.sh runs the source-tree gates (restore, build, unit, -# integration, smoke) inside mcr.microsoft.com/dotnet/sdk:10.0 — Ubuntu 24.04.5, -# SDK 10.0.401 resolving the pinned global.json, 54/54 + 28/28 + 19/19 on -# 2026-10-01, first try, 1:02.81 wall with a cold container and a cold NuGet -# cache — evidence that the 25-minute timeout below is not near. The image and compose -# gates already run a Linux image; -# the console gate needs a Chromium and stays macOS-verified until this file -# actually executes. +# scripts/ci-linux-rehearsal.sh runs the gates in containers. Source gates +# (restore, build, unit, integration, smoke) in mcr.microsoft.com/dotnet/sdk:10.0 +# — Ubuntu 24.04.5, SDK 10.0.401 resolving the pinned global.json, 54/54 + 28/28 +# + 19/19, first try, 1:02.81 wall cold: evidence that the 25-minute timeout +# below is not near. Compose gate in docker:cli against the host daemon: 27/27 on +# Linux. So every gate this file runs except the console one now has a Linux +# number; the console gate needs a Chromium and stays macOS-verified until this +# file actually executes. name: ci diff --git a/README.md b/README.md index 74bdcba..6d7425f 100644 --- a/README.md +++ b/README.md @@ -250,21 +250,30 @@ desktop and phone screenshots the CI job publishes as artifacts. ### The same gates on the runner's operating system Every green number above was produced on darwin; the workflow runs on -`ubuntu-latest`. `scripts/ci-linux-rehearsal.sh` copies the tree (no `.git`, no -host build output — Linux binaries landing in a macOS working tree make the next -`--no-build` try to exec an ELF file) and runs restore, build, unit, integration -and smoke inside `mcr.microsoft.com/dotnet/sdk:10.0`. Rehearsed 2026-10-01: -Ubuntu 24.04.5, SDK **10.0.401** resolving `dotnet/global.json` (pinned -`10.0.100`, `rollForward: latestFeature` — which is also the answer to whether -`setup-dotnet` with `10.0.x` satisfies the pin), unit **54/54**, integration -**28/28**, smoke **19/19**, first try, nothing to fix. Wall clock for the whole -rehearsal with a cold container and a cold NuGet cache: **1:02.81** — the source -job's 25-minute timeout is not close, even allowing for a runner's slower CPU. +`ubuntu-latest`. `scripts/ci-linux-rehearsal.sh` runs the gates in containers. +The source gates (restore, build, unit, integration, smoke) run against a copy of +the tree — no `.git`, no host build output, because Linux binaries landing in a +macOS working tree make the next `--no-build` try to exec an ELF file — inside +`mcr.microsoft.com/dotnet/sdk:10.0`. The compose gate runs in `docker:cli` +against the host daemon, so the image build and the stack are Linux. -It does not cover `compose-smoke` (needs a docker daemon inside the container) or -the console gate (needs a real Chromium). Both of those already drive a Linux -image, so what stays un-rehearsed there is the host-side script, not the thing -under test. +Rehearsed 2026-10-01. Source gates: Ubuntu 24.04.5, SDK **10.0.401** resolving +`dotnet/global.json` (pinned `10.0.100`, `rollForward: latestFeature` — which is +also the answer to whether `setup-dotnet` with `10.0.x` satisfies the pin), unit +**54/54**, integration **28/28**, smoke **19/19**, first try, nothing to fix; +wall clock with a cold container and a cold NuGet cache **1:02.81**, so the +source job's 25-minute timeout is not close even on a slower CPU. Compose gate on +Linux: **27 passed, 0 failed**, enforcement lag 12 ms after a ban was written. + +Getting the compose stage green surfaced two things about the harness rather than +the product, both now written into the script. The gate asserts over JSON with +**python3**: a bare container failed 23 of 27 assertions for nothing else. And +the stack the host daemon publishes lives in the host's network namespace, so +without `EDGE=http://host.docker.internal:8080` every HTTP assertion returns curl +code `000` while the image's own `HEALTHCHECK` says healthy — a green stack with +red assertions, the most confusing failure this gate can produce. + +What stays un-rehearsed: the console gate, which needs a real Chromium. Honest status of the workflow itself: it has never executed on a runner, because the repository has no remote. Everything above was run on a laptop, on the diff --git a/scripts/ci-linux-rehearsal.sh b/scripts/ci-linux-rehearsal.sh index b0a5e55..9632d00 100755 --- a/scripts/ci-linux-rehearsal.sh +++ b/scripts/ci-linux-rehearsal.sh @@ -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 ]