The console's country view was a column of numbers. "Where is this traffic
coming from" is a comparison, so each row now carries a bar sized against the
busiest country, and the table says what it counted. No tiles, no CDN, no asset
file: the runtime image is distroless and the page has to work at the moment the
site in front of it is being attacked. A geographic map is still not here and
the README now says why plainly — the admin API exposes counts per ISO code, not
coordinates, and an outline drawn from memory would be decoration that misleads.
The first run after the change failed, for a real reason: the class I added was
`.bar`, and the page already had a `.bar` — the toolbar. The toolbar collapsed
to 0.55em tall, `div#summary` started intercepting pointer events, and every
assertion after the token click died on a click timeout. Renamed to
`.sharebar`.
The gate itself got the same treatment as the page. It used to leave a reviewer
with nothing but a stack trace; now it writes a screenshot both when the page
cannot be driven at all and when it is driven and wrong. That path was checked
by making it red on purpose: with seeds that do not match the stack it exits 1
naming 3 failed assertions and writes a 105078-byte picture.
Measured, not assumed, in the same pass:
- `ci-gates.sh` gained a `console` gate and the workflow calls it by that name
instead of retyping the script: one definition, two callers. It is
deliberately NOT in `all` — without a Chromium the gate exits 2 ("cannot
run"), which is a different answer from 1 ("the page is wrong"), and folding
it in would make the one-command entry point unrunnable off a CI runner.
- `ci-gates.sh all` no longer stops at the last gate for want of an admin
token: it was dying at compose-smoke with `OPENWAF_ADMIN_TOKEN: set …` before
it could print a verdict. The throwaway for the stack the gate starts and
tears down itself is defaulted there; the standalone scripts still refuse to
invent one, because run by hand they can be pointed at a real deployment.
- The console job publishes the desktop and phone screenshots as artifacts,
with `if: always()` so the failure case is the one you can look at. The
relative SCREENSHOT path and the `console-evidence*.png` glob were verified
locally: 107935 and 86179 bytes written.
- DBIP_VERSION 2026-09 -> 2026-10. Not a cache hit: 8348509 bytes fetched,
image 261 MB, compose smoke 27/27 afterwards.
- The trap that bump exposes, measured rather than reasoned about: the same
rebuilt image reported `geoBuiltAt: 2026-09-01T01:32:45Z` against the
existing `openwaf_openwaf-geoip` volume and `2026-10-01T01:36:12Z` after
removing it. Docker seeds a named volume from the image only when the volume
is first created, so a rebuild alone never replaces the geo database.
Gates on this commit: build 0 warnings / 0 errors, unit 54/54, integration
27/27, smoke 19/19, image 261 MB, compose-smoke 27/27, console 16/16 (desktop
bar 513 px inside a 529 px cell; phone pass at 375 px in dark mode: scrollWidth
375, status contrast 11.85:1, bars 67 px), actionlint 0, shellcheck 0. Still
true, and unchanged by any of the above: not one of these jobs has run on a
runner, because the repository has no remote.
71 lines
3.1 KiB
Bash
Executable File
71 lines
3.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# One file says what each gate *is*, so "what CI runs" and "what an operator ran
|
|
# before pushing" stop being two different claims. CI calls one gate per step, so
|
|
# the job log still names the gate that failed; `all` runs them in order and
|
|
# stops at the first failure.
|
|
#
|
|
# scripts/ci-gates.sh restore|build|unit|integration|smoke|image|compose-smoke|all
|
|
# scripts/ci-gates.sh console (needs a real Chromium; not part of `all`)
|
|
#
|
|
# OPENWAF_ADMIN_TOKEN defaults below to the same throwaway CI uses; set it to
|
|
# override. Nothing here talks to anything outside the run.
|
|
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
|
|
# The compose gate needs an admin token for the stack it starts. It is not a
|
|
# secret — that stack exists only inside this run and is torn down on exit — but
|
|
# requiring it meant `ci-gates.sh all` stopped at the last gate for anyone who
|
|
# forgot to export one, which made the one-command entry point a lie. Same value
|
|
# CI uses, overridable by the caller.
|
|
export OPENWAF_ADMIN_TOKEN="${OPENWAF_ADMIN_TOKEN:-ci-only-throwaway}"
|
|
|
|
banner() { printf '\n\033[1m=== gate: %s ===\033[0m\n' "$1"; }
|
|
|
|
restore() { banner restore; dotnet restore dotnet/OpenWaf.slnx; }
|
|
|
|
# TreatWarningsAsErrors is set in Directory.Build.props, so this is also the
|
|
# warning gate.
|
|
build() { banner build; dotnet build dotnet/OpenWaf.slnx -c Release --no-restore; }
|
|
|
|
unit() { banner unit; dotnet test dotnet/OpenWaf.Tests.Unit/OpenWaf.Tests.Unit.csproj -c Release --no-build; }
|
|
|
|
integration() { banner integration; dotnet test dotnet/OpenWaf.Tests.Integration/OpenWaf.Tests.Integration.csproj -c Release --no-build; }
|
|
|
|
smoke() { banner smoke; ./scripts/smoke.sh; }
|
|
|
|
# The plain build the README shows, plus its size: the compose path would hide a
|
|
# Dockerfile regression that this step catches.
|
|
image() { banner image; docker build -t openwaf:ci .; docker image ls openwaf:ci --format '{{.Repository}}:{{.Tag}} {{.Size}}'; }
|
|
|
|
compose_smoke() { banner compose-smoke; ./scripts/compose-smoke.sh; }
|
|
|
|
# The browser gate over the operator page. It is a gate, so it lives here too and
|
|
# CI calls it by the same name. It is NOT part of `all`: it needs a real
|
|
# Chromium, and a machine without one exits 2 ("cannot run"), which is a
|
|
# different answer from 1 ("the page is wrong") and would otherwise make the
|
|
# one-command entry point unrunnable. Run it explicitly before pushing a change
|
|
# to the console.
|
|
console() { banner console; ./scripts/console-smoke.sh; }
|
|
|
|
case "${1:-all}" in
|
|
restore) restore ;;
|
|
build) build ;;
|
|
unit) unit ;;
|
|
integration) integration ;;
|
|
smoke) smoke ;;
|
|
image) image ;;
|
|
compose-smoke) compose_smoke ;;
|
|
console) console ;;
|
|
all)
|
|
restore; build; unit; integration; smoke; image; compose_smoke
|
|
printf '\nall gates passed\n'
|
|
printf 'NOT included above: console (needs a real Chromium; exits 2 without one).\n'
|
|
printf 'If the console changed, run: %s console\n' "$0"
|
|
;;
|
|
*)
|
|
printf 'usage: %s restore|build|unit|integration|smoke|image|compose-smoke|console|all\n' "$0" >&2
|
|
exit 2
|
|
;;
|
|
esac
|