The console gate has a Linux number now, in a real Chromium

The rehearsal covered the dotnet suites, smoke.sh and compose-smoke.sh, and
then printed "console gate: not covered here (needs a real Chromium)". That was
the one honest line in the summary, and it was also the last hole: the console
job in `.github/workflows/ci.yml` runs on ubuntu-latest, so its gate was
verified only on darwin.

`scripts/ci-linux-rehearsal.sh console` closes it. `scripts/console-smoke.sh`
grew `SEED_ONLY=1` (start the stack, seed the streaks/bans/allow entries the
page must show, then stop before driving the page) and an `EDGE` override, so
the seeding half runs in `docker:cli` against the host daemon and the browser
half runs in `mcr.microsoft.com/playwright:v1.63.0-noble` — the Playwright
version pinned there is the version the CI console job pins, or the rehearsal
is rehearsing something else. The stack is torn down either way.

Two facts about that image, both now comments in the script:

- It ships the browsers (`/ms-playwright`: chromium-1243) but **not** the npm
  package — there is no playwright-core anywhere in it. So the stage installs
  `playwright@1.63.0` into `/tmp` and points `PLAYWRIGHT_CORE` at
  `/tmp/node_modules/playwright-core`.
- The repo is mounted read-only for this stage. Writable, the install would
  have dropped `node_modules` into the working tree of the checkout.

The summary line also stopped lying by accident: `verdict()` now separates a
stage the caller never asked for ("not run") from a stage that could not run
("skipped (no docker socket)"), and the exit code includes the console stage.

Two full rehearsals on this tree, one invocation each, both EXIT=0:

    source gates (restore/build/unit/integration/smoke): PASS   54/54, 28/28, 19/19
    compose gate: PASS                                          27 passed, 0 failed
    console gate: PASS                                          26 assertions, 0 failed
    wall: 2:14.33 (cold containers, cold NuGet cache)

72 assertions pass from inside Linux, and the console half includes the
round-trip a page cannot fake: a ban drawn on the page answers 301 on the next
request from that address, and the address passes again once the row is
deleted. actionlint 1.7.12 (same pinned checksum as CI): 0 problems. shellcheck
and `bash -n` clean.

Still true: none of this has executed on a runner, because the repository has
no remote. The Linux numbers narrow what a first run can discover; they do not
replace one.
This commit is contained in:
Pavlo Ratushnyi
2026-10-01 15:50:51 +02:00
parent c290aa06f6
commit e02e442ae2
4 changed files with 126 additions and 25 deletions
+5 -3
View File
@@ -19,9 +19,11 @@
# — 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.
# Linux. Console gate in mcr.microsoft.com/playwright:v1.63.0-noble — the stack
# seeded by docker:cli, the same console-check.cjs driving it in a real Linux
# Chromium: 26/26. So every gate this file runs now has a Linux number. What it
# does not have is a runner: the repository has no remote, so this file has
# never executed on GitHub.
name: ci
+14 -1
View File
@@ -264,6 +264,7 @@ also the answer to whether `setup-dotnet` with `10.0.x` satisfies the pin), unit
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.
Console gate on Linux: **26 assertions, 0 failed** — described below.
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
@@ -273,7 +274,19 @@ without `EDGE=http://host.docker.internal:8080` every HTTP assertion returns cur
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.
The console gate needs a real Chromium, so it runs in
`mcr.microsoft.com/playwright:v1.63.0-noble`: `scripts/console-smoke.sh` with
`SEED_ONLY=1` starts and seeds the stack from `docker:cli`, the browser image
drives `scripts/console-check.cjs` against `EDGE=http://host.docker.internal:8080`,
and the stack is torn down afterwards. That image ships the browsers but not the
npm package, so the script installs `playwright-core` into `/tmp` and points
`PLAYWRIGHT_CORE` at it, mounting the repository read-only so the install never
lands in the working tree. Rehearsed the same day on Linux 7.0.12-linuxkit
aarch64, node v24.20.0, `chromium-1243`: **26 assertions, 0 failed**, including
the round-trip the page alone cannot fake — a ban drawn on the page answers 301
on the next request from that address. All three scenes in one cold run:
**2:14.33**.
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
+95 -20
View File
@@ -6,15 +6,15 @@
# 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 # source gates, then the compose gate
# scripts/ci-linux-rehearsal.sh # all three stages
# scripts/ci-linux-rehearsal.sh source # restore, build, unit, integration, smoke
# scripts/ci-linux-rehearsal.sh compose # compose-smoke against the host daemon
# scripts/ci-linux-rehearsal.sh console # the page, in a real Chromium on Linux
#
# 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.
# runner installs), compose-smoke.sh (Alpine container, linux image build, the
# host daemon doing the work) and the console gate (the official Playwright image
# with the same Playwright version the CI console job pins).
set -euo pipefail
cd "$(dirname "$0")/.."
@@ -22,13 +22,47 @@ cd "$(dirname "$0")/.."
STAGE=${1:-all}
SOURCE_IMAGE=${SOURCE_IMAGE:-mcr.microsoft.com/dotnet/sdk:10.0}
COMPOSE_IMAGE=${COMPOSE_IMAGE:-docker:cli}
BROWSER_IMAGE=${BROWSER_IMAGE:-mcr.microsoft.com/playwright:v1.63.0-noble}
# The version the CI console job pins. If these two ever disagree, the
# rehearsal is not rehearsing what CI will do.
PLAYWRIGHT_VERSION=${PLAYWRIGHT_VERSION:-1.63.0}
DOCKER_SOCKET=${DOCKER_SOCKET:-/var/run/docker.sock}
# The stack is created by the host daemon, so its published port lives in the
# host's namespace; from inside a container that is the gateway, not 127.0.0.1.
HOST_EDGE=${HOST_EDGE:-http://host.docker.internal:8080}
OPENWAF_ADMIN_TOKEN=${OPENWAF_ADMIN_TOKEN:-ci-only-throwaway}
export OPENWAF_ADMIN_TOKEN DOTNET_CLI_TELEMETRY_OPTOUT=1 DOTNET_NOLOGO=1
source_status=0
compose_status=0
console_status=0
source_ran=0
compose_ran=0
console_ran=0
# A stage the caller never asked for and a stage that could not run are
# different answers. Printing "skipped (no docker socket)" for a stage that was
# not selected is the kind of lie a summary line tells by accident.
verdict() {
ran=$1; status=$2; selected=$3; needs_socket=$4
if [ "$ran" -eq 1 ]; then
if [ "$status" -eq 0 ]; then echo PASS; else echo "FAIL ($status)"; fi
elif [ "$selected" -eq 0 ]; then
echo 'not run'
elif [ "$needs_socket" -eq 1 ]; then
echo 'skipped (no docker socket)'
else
echo 'not run'
fi
}
source_selected=0; compose_selected=0; console_selected=0
case "$STAGE" in
all) source_selected=1; compose_selected=1; console_selected=1 ;;
source) source_selected=1 ;;
compose) compose_selected=1 ;;
console) console_selected=1 ;;
esac
if [ "$STAGE" = all ] || [ "$STAGE" = source ]; then
WORK=$(mktemp -d /tmp/openwaf-linux.XXXXXX)
@@ -38,6 +72,7 @@ if [ "$STAGE" = all ] || [ "$STAGE" = source ]; then
# make the next local `--no-build` try to exec an ELF file.
tar --exclude='./.git' --exclude='bin' --exclude='obj' -cf - . | tar -xf - -C "$WORK"
source_ran=1
echo "== source gates in $SOURCE_IMAGE =="
docker run --rm -v "$WORK:/src" -w /src \
-e DOTNET_CLI_TELEMETRY_OPTOUT=1 -e DOTNET_NOLOGO=1 \
@@ -112,26 +147,66 @@ if [ "$STAGE" = all ] || [ "$STAGE" = compose ]; then
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)"
if [ "$STAGE" = all ] || [ "$STAGE" = console ]; then
if [ ! -S "$DOCKER_SOCKET" ]; then
echo "console stage SKIPPED: no docker socket at $DOCKER_SOCKET"
else
console_ran=1
echo "== console gate: seeded by $COMPOSE_IMAGE, driven in $BROWSER_IMAGE =="
# Start and seed the stack through the host daemon, and leave it up: the
# page is driven from the next container, which is the one with a Chromium.
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="$HOST_EDGE" -e SEED_ONLY=1 \
"$COMPOSE_IMAGE" sh -euo pipefail -c '
command -v bash >/dev/null || apk add --no-cache bash >/dev/null
command -v curl >/dev/null || apk add --no-cache curl >/dev/null
bash ./scripts/console-smoke.sh
' || console_status=$?
if [ "$console_status" -eq 0 ]; then
docker run --rm \
-v "$PWD:$PWD:ro" -w /tmp \
--add-host=host.docker.internal:host-gateway \
-e EDGE_URL="$HOST_EDGE" -e OPENWAF_ADMIN_TOKEN \
-e SEED_SOURCE=203.0.113.55 -e SEED_BLOCK=203.0.113.77 \
-e SCREENSHOT=/tmp/console-linux.png \
-e CHECK="$PWD/scripts/console-check.cjs" \
-e PW_VERSION="$PLAYWRIGHT_VERSION" \
"$BROWSER_IMAGE" bash -euo pipefail -c '
echo "-- what the container is --"
uname -srm
node --version
ls /ms-playwright | head -3
# The official image ships the browsers (PLAYWRIGHT_BROWSERS_PATH is
# /ms-playwright) but NOT the npm package — checked, there is no
# playwright-core anywhere in it. So the package is installed here at
# the version the CI console job pins, into /tmp: the repo is mounted
# read-only for this stage, and node_modules must not land in it.
npm init -y >/dev/null 2>&1
npm install --no-save "playwright@${PW_VERSION}" >/dev/null 2>&1
node -e "console.log(\"playwright-core: \" + require.resolve(\"playwright-core\"))"
echo "== gate: console =="
PLAYWRIGHT_CORE=/tmp/node_modules/playwright-core node "$CHECK"
' || console_status=$?
fi
docker run --rm -v "$PWD:$PWD" -w "$PWD" \
-v "$DOCKER_SOCKET:/var/run/docker.sock" \
"$COMPOSE_IMAGE" sh -c 'docker compose down >/dev/null 2>&1 || true'
fi
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
source_verdict=$(verdict "$source_ran" "$source_status" "$source_selected" 0)
compose_verdict=$(verdict "$compose_ran" "$compose_status" "$compose_selected" 1)
console_verdict=$(verdict "$console_ran" "$console_status" "$console_selected" 1)
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'
printf ' console gate: %s\n' "$console_verdict"
[ "$source_status" -eq 0 ] && [ "$compose_status" -eq 0 ]
[ "$source_status" -eq 0 ] && [ "$compose_status" -eq 0 ] && [ "$console_status" -eq 0 ]
+12 -1
View File
@@ -9,12 +9,13 @@
# asserted nothing is worse than no gate.
#
# OPENWAF_ADMIN_TOKEN=… SCREENSHOT=/tmp/console.png ./scripts/console-smoke.sh
# SEED_ONLY=1 … same, but leave the seeded stack for something else to drive
set -euo pipefail
cd "$(dirname "$0")/.."
export OPENWAF_ADMIN_TOKEN="${OPENWAF_ADMIN_TOKEN:?set OPENWAF_ADMIN_TOKEN before running, or run scripts/ci-gates.sh (it defaults a throwaway for the stack it starts itself)}"
EDGE=http://127.0.0.1:8080
EDGE=${EDGE:-http://127.0.0.1:8080}
SEED_SOURCE=203.0.113.55
SEED_BLOCK=203.0.113.77
export EDGE_URL="$EDGE" SEED_SOURCE SEED_BLOCK
@@ -66,5 +67,15 @@ admin -X POST -H 'Content-Type: application/json' \
# the policy write needed. Without it the page is correct and the gate is wrong.
sleep 35
# SEED_ONLY=1 stops after the seed and leaves the stack running: the page is not
# driven from here. That is what scripts/ci-linux-rehearsal.sh uses to drive it
# from a container that has a real Chromium, and it is also what you want when
# debugging the page by hand against a stack that already has something to show.
if [ "${SEED_ONLY:-0}" = 1 ]; then
echo '- SEED_ONLY=1: stack is up and seeded at '"$EDGE"'; the page is not driven from here'
trap - EXIT
exit 0
fi
echo '- driving the page'
node scripts/console-check.cjs