ci / the operator page in a real browser (push) Successful in 2m38s
ci / lint the workflow and the shell (push) Successful in 13s
geo-freshness / the pinned geo database vs the vendor (push) Successful in 4s
ci / build, test, smoke (push) Successful in 2m48s
ci / build the image and smoke it (push) Successful in 4m23s
ci / the same smoke on an image with no base (push) Successful in 5m3s
Dockerfile.scratch builds the same program self-contained and puts it on scratch: 12 shared objects and the CA bundle — 18.7 MB — carried at their absolute paths, because a scratch layer has nothing to borrow them from, and the dynamic loader has to land at the path recorded inside the binary or the kernel refuses to start the process. Measured on one arm64 host: chiseled 262 MB, scratch 222 MB. scripts/compose-smoke.sh runs against it unchanged through docker-compose.scratch.yml: 368 passed, 0 failed, and 368/0 again when the same gate is called as scripts/ci-gates.sh scratch-smoke. The first scratch image built here is why that second run matters. It started, its own HEALTHCHECK reported healthy, and it still failed 7 of the 368. A self-contained apphost takes its content root from the process's working directory, a scratch image has no WORKDIR, so the process began in /, never found the appsettings.json next to it, the reverse proxy had no routes, and every request that should have reached the upstream answered the edge's own 404 — including /boom's 502, which turned the "server errors alert, they never ban" scene into a streak ban. The edge said it in its own log: "Request reached the end of the middleware pipeline without being handled by application code." The schema-script gate was red on the runner at7c5e1ef(run 2462, exit 2): `dotnet tool restore` from the repo root finds no manifest, prints "No tools were restored." and exits 0, so the gate's own restore check passed vacuously and `dotnet ef` then died. It now restores dotnet/dotnet-tools.json by path and asks the tool for its version before trusting it. NativeAOT, measured further: with the two alert-queue queries taken out, `dotnet ef dbcontext optimize --precompile-queries` on EF 10.0.12 reports 0 precompilation errors and writes 8 interceptor files — 14 of whose declarations have dots in the identifier, because the local is named from the entity type's full name. The 4 refusals that remain are four shapes the generator cannot translate at all: Contains over a captured collection, any method parameter referenced inside a query (down to the CancellationToken), an ExecuteUpdate set-list, and a literal whose type is not the column's. docs/ARCHITECTURE.md carries the exception for each. No C# changed in this commit: the experiments that produced those numbers were reverted, and the query rewrites kept at7c5e1efare the ones that made 40 refusals into 4. Gates: scratch-image and scratch-smoke in scripts/ci-gates.sh and in `all`, and a fifth CI job that runs the 368 against the scratch image on the runner.
562 lines
32 KiB
YAML
562 lines
32 KiB
YAML
# The gates OPEN-2's evidence rests on, run by something other than an agent who
|
|
# chose to run them. Four mergeEvidence fields on that epic say "no CI pipeline
|
|
# exists yet — every gate quoted above was run locally"; this closes that.
|
|
#
|
|
# Honest status of this file itself, as of the run that first executed it: the
|
|
# repository's remote is Gitea at git.vezha.io (ssh git@vezha.io), and its
|
|
# Actions runner ran this file on a push — run 2316, head 6f92d37, 2026-10-05.
|
|
# Three of the four jobs below were red there, each with a named cause: lint
|
|
# found two SC2086 findings in scripts/smoke.sh (now fixed), and the image and
|
|
# console jobs died on `docker: command not found`, because the runner's job
|
|
# image ships no docker CLI even though /var/run/docker.sock is mounted from the
|
|
# host — which is why both jobs install docker-ce-cli and docker-compose-plugin
|
|
# themselves. `build, test, smoke` was green: 1m53s, unit and integration and
|
|
# smoke on Linux. Before that run this file had only ever executed start to
|
|
# finish in a local Actions-compatible runner (nektos/act 0.2.89, image
|
|
# catthehacker/ubuntu:act-latest), where all four jobs below and the freshness
|
|
# job in geo-freshness.yml reported success. That run proves the YAML plays and the pinned tools
|
|
# resolve — and it is how the lint
|
|
# job's shellcheck version drift was found (ubuntu-latest ships 0.9.0-1, the
|
|
# pinned step now runs 0.11.0 with a checksum). Do not read this file as proof
|
|
# that CI on GitHub is green: it is proof of what CI will run, executed once by
|
|
# something other than an agent who chose the steps. What narrowed the gap
|
|
# further is that the steps below no longer retype the commands: they call
|
|
# scripts/ci-gates.sh, the same file an operator runs as `scripts/ci-gates.sh
|
|
# all` before pushing. One definition of a gate, two callers, so a local green
|
|
# run and a CI green run cannot drift apart.
|
|
#
|
|
# Timeouts are explicit. The first build of this project stalled ~12 minutes on
|
|
# 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 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: unit 132/132,
|
|
# integration 173/173, smoke 28/28, first try (at dc88f36). Compose gate in docker:cli against
|
|
# the host daemon: 185/185 on 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: 70/70. The
|
|
# only wall clock ever measured for the source job is 1:02.81 cold (first
|
|
# rehearsal); later rehearsals were not re-timed, so that number is quoted as
|
|
# measured once, not as current. So every gate this file runs has a Linux
|
|
# number, and a runner has now executed it: run 2316 on the Gitea instance,
|
|
# where the source job took 1m53s and was the only green one — the rest of the
|
|
# reds are the docker-CLI and shellcheck causes named at the top of this file. It has been executed by a local
|
|
# Actions-compatible runner (nektos/act 0.2.89, catthehacker/ubuntu:act-latest)
|
|
# at dc88f36: 5 jobs succeeded, 0 failed - lint, source (132/132, 173/173, smoke
|
|
# 28/0), image (261 MB, compose smoke 185/0), console (70 assertions, screenshot
|
|
# artifact, 685,222-byte zip) and freshness (pin 2026-10 = newest 2026-10).
|
|
# The two runs before that one failed for reasons worth naming: lint refused three
|
|
# SC2086 findings the local shellcheck run had passed over (no local gate runs lint
|
|
# at all - OPEN-44), and in the next run image died on a TLS timeout to auth.docker.io
|
|
# while console read an empty observation listing in a run that had shown 11 rows
|
|
# a minute earlier (OPEN-43).
|
|
|
|
name: ci
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
# Two pushes in a row should not queue two full gate runs behind each other.
|
|
# cancel-in-progress is deliberately false: a run that finishes is the evidence
|
|
# a merge decision gets read later, and cancelling the run that is already
|
|
# executing throws that away to save nothing. GitHub keeps the newest pending
|
|
# run and drops the ones still waiting behind it, which is the part worth
|
|
# dropping.
|
|
concurrency:
|
|
group: ci-${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: false
|
|
|
|
env:
|
|
DOTNET_NOLOGO: "1"
|
|
DOTNET_CLI_TELEMETRY_OPTOUT: "1"
|
|
# The compose smoke test needs a token to exercise the admin API. It is not a
|
|
# secret: it is a throwaway value for a stack that exists only inside the job.
|
|
OPENWAF_ADMIN_TOKEN: ci-only-throwaway
|
|
# Where each gate writes the number of assertions it actually ran, so the step
|
|
# after it can compare that with the number the README claims (OPEN-46). Per
|
|
# job, not shared: each job runs its own gate and verifies its own number.
|
|
GATE_TOTALS_DIR: /tmp/openwaf-gate-totals
|
|
|
|
jobs:
|
|
lint:
|
|
name: lint the workflow and the shell
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
# The linter itself is pinned to a version and a checksum, not piped from
|
|
# a setup script: a gate that can be moved by someone republishing a tag is
|
|
# not a gate. actionlint also checks the run: blocks below with shellcheck.
|
|
# One definition of the lint gate, two callers (OPEN-44). The versions and
|
|
# checksums are pinned in scripts/ci-gates.sh, the same file an operator runs
|
|
# as `scripts/ci-gates.sh lint` before pushing a workflow or script change —
|
|
# so "green locally" and "green here" are the same claim about the same pinned
|
|
# tools instead of two definitions that can drift. They were pinned here
|
|
# because the copy baked into the image made the verdict depend on the image:
|
|
# ubuntu-latest ships shellcheck 0.9.0-1, and a local Actions-compatible runner
|
|
# (nektos/act on catthehacker/ubuntu:act-latest) had 0.9.0 flag an `A && B || C`
|
|
# pattern in scripts/geo-db-bump.sh that the 0.11.0 the developers run locally
|
|
# does not. The script was rewritten as an explicit if and the version fixed,
|
|
# and the log prints which version did the linting. The script exits 2 when the
|
|
# tools cannot run at all, which fails this job rather than reporting a pass.
|
|
- name: actionlint + shellcheck (pinned, checksum verified)
|
|
run: ./scripts/ci-gates.sh lint
|
|
|
|
source:
|
|
name: build, test, smoke
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 25
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install the SDK pinned by dotnet/global.json
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: |
|
|
10.0.x
|
|
|
|
# One gate per step so the job log still names the one that failed; the
|
|
# definitions live in scripts/ci-gates.sh, not here.
|
|
- name: Restore
|
|
run: ./scripts/ci-gates.sh restore
|
|
|
|
- name: Build (also the warning gate — TreatWarningsAsErrors)
|
|
run: ./scripts/ci-gates.sh build
|
|
|
|
- name: Unit tests — the decision core
|
|
run: ./scripts/ci-gates.sh unit
|
|
|
|
- name: Integration tests — the real pipeline against a fake upstream
|
|
run: ./scripts/ci-gates.sh integration
|
|
|
|
# The image ships a DDL file generated from the EF model rather than
|
|
# deriving the schema at start-up, because a NativeAOT build cannot ask EF
|
|
# to build a model at run time. This step regenerates it and refuses the
|
|
# run when the committed copy is not what the current model produces.
|
|
- name: The DDL the image ships is what the model generates
|
|
run: ./scripts/ci-gates.sh schema-script
|
|
|
|
- name: Smoke — a running edge and a real upstream, curl assertions
|
|
run: ./scripts/ci-gates.sh smoke
|
|
|
|
# The README quotes an assertion count per gate. It used to be copied by
|
|
# hand out of a log and it drifted (OPEN-46: 229 claimed against 356
|
|
# printed). This step makes the README pay for the number it prints.
|
|
- name: README assertion counts match what the gate ran
|
|
run: ./scripts/ci-gates.sh readme-counts scripts/smoke.sh
|
|
|
|
image:
|
|
name: build the image and smoke it
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
# The gate below talks to docker, and the runner's job image does not ship
|
|
# the docker CLI. Measured, not guessed: the first real run of this file
|
|
# (Gitea Actions run 2316, head 6f92d37) died here with
|
|
# `./scripts/ci-gates.sh: line 44: docker: command not found`, exit 127.
|
|
# /var/run/docker.sock is mounted from the host, so what is missing is the
|
|
# client side: the CLI, the compose v2 plugin, and buildx — `docker compose
|
|
# up --build` reaches the daemon through buildx, so the compose plugin alone
|
|
# does not bring this stack up. The same install the neemle-landing
|
|
# pipeline on this instance uses. Pinned to the Debian bookworm docker.com
|
|
# repo so the version does not drift with the image.
|
|
- 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
|
|
# compose-smoke.sh calls `docker compose`, and every command in it
|
|
# talks to the host daemon over the mounted socket. A missing socket is
|
|
# an infrastructure answer, so it says so here rather than failing
|
|
# three steps later as a broken product.
|
|
docker --version
|
|
docker compose version
|
|
docker buildx version
|
|
[ -S /var/run/docker.sock ] || { echo "no /var/run/docker.sock on this runner"; exit 1; }
|
|
docker info --format 'daemon {{.ServerVersion}} on {{.OperatingSystem}}'
|
|
|
|
# The plain build, the one the README shows, plus its size: this is the
|
|
# step that catches a Dockerfile regression the compose path would hide.
|
|
- name: docker build and image size
|
|
run: ./scripts/ci-gates.sh image
|
|
|
|
# The nginx config reaches the upstream container through a named volume
|
|
# here, not through a workspace path — docker-compose.ci.yml explains why
|
|
# (the host daemon cannot see the job container's workspace). Compose names
|
|
# the volume after the project, so the name is built, not guessed.
|
|
- name: Put the upstream config where the host daemon can see it
|
|
env:
|
|
COMPOSE_PROJECT_NAME: openwafci-image
|
|
run: |
|
|
set -eu
|
|
VOL="${COMPOSE_PROJECT_NAME}_openwaf-upstream-conf"
|
|
# A run that died mid-scene leaves its bans in the stack's data volume:
|
|
# `compose down` keeps named volumes, and the runner reuses the same
|
|
# project name every push. Measured on run 2361, where the 502-upstream
|
|
# scene opened with the source already banned (expected 502, got 403)
|
|
# because runs 2350 and 2355 left state behind. The gate's own scenes
|
|
# rely on data outliving `compose down`, so the clean has to happen
|
|
# before the stack starts, not in its teardown.
|
|
docker volume rm "${COMPOSE_PROJECT_NAME}_openwaf-data" \
|
|
"${COMPOSE_PROJECT_NAME}_openwaf-geoip" >/dev/null 2>&1 || true
|
|
docker volume create "$VOL" >/dev/null
|
|
docker run --rm -i -v "$VOL:/conf" busybox:1.37 sh -c 'cat > /conf/default.conf' < deploy/upstream.conf
|
|
docker run --rm -v "$VOL:/conf" busybox:1.37 sh -c 'wc -c /conf/default.conf'
|
|
|
|
# The second half of the same asymmetry: compose publishes the edge's port on
|
|
# the HOST, while the job that curls it lives in its own network namespace, so
|
|
# 127.0.0.1:<port> is refused there. Measured on run 2350: the edge container
|
|
# reached `healthy`, and the gate's first admin call died with curl exit 7.
|
|
# The default-route address of the job container is the host's own address on
|
|
# that network, and compose publishes on 0.0.0.0, so that is the address the
|
|
# gate has to be pointed at. (tskr solves the same platform quirk by running
|
|
# its gates in sibling containers — see docker/test/workspace-mount.sh there.)
|
|
- name: Name the address the job can reach the published ports on
|
|
run: |
|
|
set -eu
|
|
# `ip` is not in this image (measured: `ip: command not found`, exit 127),
|
|
# so the route is read from the kernel's own table. The gateway there is
|
|
# hex, little-endian, and bash turns it back into dotted quad.
|
|
GWHEX=$(awk '$2=="00000000" {print $3; exit}' /proc/net/route)
|
|
[ -n "$GWHEX" ] || { echo "no default route in /proc/net/route"; exit 1; }
|
|
GW=$(printf '%d.%d.%d.%d' "0x${GWHEX:6:2}" "0x${GWHEX:4:2}" "0x${GWHEX:2:2}" "0x${GWHEX:0:2}")
|
|
echo "OPENWAF_EDGE_HOST=$GW" >> "$GITHUB_ENV"
|
|
echo "the gate will ask the edge at $GW"
|
|
|
|
# Brings up edge + nginx, waits for the image's own HEALTHCHECK, asserts
|
|
# over a socket, and tears the stack down on exit.
|
|
- name: Compose smoke — the deployed image
|
|
env:
|
|
# The CI overlay: the upstream config comes from the volume the step
|
|
# above filled. Compose reads COMPOSE_FILE itself, so the gate script
|
|
# stays the one an operator runs.
|
|
COMPOSE_FILE: docker-compose.yml:docker-compose.ci.yml
|
|
# Its own compose project and its own host port. The console job below
|
|
# brings up the same file, and on any machine where two jobs share one
|
|
# docker daemon (a self-hosted runner, a local act run) the default
|
|
# project name and the default 8080 make them the same stack: one
|
|
# job's `compose down` is the other's connection refused. Measured, not
|
|
# guessed — see the comment in docker-compose.yml.
|
|
COMPOSE_PROJECT_NAME: openwafci-image
|
|
EDGE_PORT: "8080"
|
|
EDGE: http://${{ env.OPENWAF_EDGE_HOST }}:8080
|
|
run: ./scripts/ci-gates.sh compose-smoke
|
|
|
|
- name: README assertion counts match what the gate ran
|
|
run: ./scripts/ci-gates.sh readme-counts scripts/compose-smoke.sh
|
|
|
|
# The same stack, the same 368 assertions, and an image whose base is nothing:
|
|
# scratch plus the shared objects the program was linked against, the NSS
|
|
# modules getaddrinfo needs, OpenSSL, and the CA bundle. This is the job that
|
|
# answers "will it behave on a production host" for that shape — the first
|
|
# scratch image built here passed its own HEALTHCHECK and still failed 7 of the
|
|
# 368, because a self-contained apphost with no WORKDIR starts in / and never
|
|
# finds its appsettings.json, so the proxy had no routes and every request that
|
|
# should have reached the upstream answered the edge's own 404.
|
|
scratch-image:
|
|
name: the same smoke on an image with no base
|
|
runs-on: ubuntu-latest
|
|
# Longer than the image job: a self-contained publish carries the runtime
|
|
# into the image instead of borrowing a base layer's, and the build cache on
|
|
# the shared runner is cold for a second Dockerfile.
|
|
timeout-minutes: 40
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
# The gate below talks to docker, and the runner's job image does not ship
|
|
# the docker CLI. Measured, not guessed: the first real run of this file
|
|
# (Gitea Actions run 2316, head 6f92d37) died here with
|
|
# `./scripts/ci-gates.sh: line 44: docker: command not found`, exit 127.
|
|
# /var/run/docker.sock is mounted from the host, so what is missing is the
|
|
# client side: the CLI, the compose v2 plugin, and buildx — `docker compose
|
|
# up --build` reaches the daemon through buildx, so the compose plugin alone
|
|
# does not bring this stack up. The same install the neemle-landing
|
|
# pipeline on this instance uses. Pinned to the Debian bookworm docker.com
|
|
# repo so the version does not drift with the image.
|
|
- 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
|
|
# compose-smoke.sh calls `docker compose`, and every command in it
|
|
# talks to the host daemon over the mounted socket. A missing socket is
|
|
# an infrastructure answer, so it says so here rather than failing
|
|
# three steps later as a broken product.
|
|
docker --version
|
|
docker compose version
|
|
docker buildx version
|
|
[ -S /var/run/docker.sock ] || { echo "no /var/run/docker.sock on this runner"; exit 1; }
|
|
docker info --format 'daemon {{.ServerVersion}} on {{.OperatingSystem}}'
|
|
|
|
# The scratch build plus both images' sizes, so the difference between
|
|
# "chiseled" and "nothing at all" is a number in the run log rather than a
|
|
# claim in a README.
|
|
- name: docker build -f Dockerfile.scratch and image size
|
|
run: ./scripts/ci-gates.sh scratch-image
|
|
|
|
# The nginx config reaches the upstream container through a named volume
|
|
# here, not through a workspace path — docker-compose.ci.yml explains why
|
|
# (the host daemon cannot see the job container's workspace). Compose names
|
|
# the volume after the project, so the name is built, not guessed.
|
|
- name: Put the upstream config where the host daemon can see it
|
|
env:
|
|
COMPOSE_PROJECT_NAME: openwafci-scratch
|
|
run: |
|
|
set -eu
|
|
VOL="${COMPOSE_PROJECT_NAME}_openwaf-upstream-conf"
|
|
# A run that died mid-scene leaves its bans in the stack's data volume:
|
|
# `compose down` keeps named volumes, and the runner reuses the same
|
|
# project name every push. Measured on run 2361, where the 502-upstream
|
|
# scene opened with the source already banned (expected 502, got 403)
|
|
# because runs 2350 and 2355 left state behind. The gate's own scenes
|
|
# rely on data outliving `compose down`, so the clean has to happen
|
|
# before the stack starts, not in its teardown.
|
|
docker volume rm "${COMPOSE_PROJECT_NAME}_openwaf-data" \
|
|
"${COMPOSE_PROJECT_NAME}_openwaf-geoip" >/dev/null 2>&1 || true
|
|
docker volume create "$VOL" >/dev/null
|
|
docker run --rm -i -v "$VOL:/conf" busybox:1.37 sh -c 'cat > /conf/default.conf' < deploy/upstream.conf
|
|
docker run --rm -v "$VOL:/conf" busybox:1.37 sh -c 'wc -c /conf/default.conf'
|
|
|
|
# The second half of the same asymmetry: compose publishes the edge's port on
|
|
# the HOST, while the job that curls it lives in its own network namespace, so
|
|
# 127.0.0.1:<port> is refused there. Measured on run 2350: the edge container
|
|
# reached `healthy`, and the gate's first admin call died with curl exit 7.
|
|
# The default-route address of the job container is the host's own address on
|
|
# that network, and compose publishes on 0.0.0.0, so that is the address the
|
|
# gate has to be pointed at. (tskr solves the same platform quirk by running
|
|
# its gates in sibling containers — see docker/test/workspace-mount.sh there.)
|
|
- name: Name the address the job can reach the published ports on
|
|
run: |
|
|
set -eu
|
|
# `ip` is not in this image (measured: `ip: command not found`, exit 127),
|
|
# so the route is read from the kernel's own table. The gateway there is
|
|
# hex, little-endian, and bash turns it back into dotted quad.
|
|
GWHEX=$(awk '$2=="00000000" {print $3; exit}' /proc/net/route)
|
|
[ -n "$GWHEX" ] || { echo "no default route in /proc/net/route"; exit 1; }
|
|
GW=$(printf '%d.%d.%d.%d' "0x${GWHEX:6:2}" "0x${GWHEX:4:2}" "0x${GWHEX:2:2}" "0x${GWHEX:0:2}")
|
|
echo "OPENWAF_EDGE_HOST=$GW" >> "$GITHUB_ENV"
|
|
echo "the gate will ask the edge at $GW"
|
|
|
|
# Brings up edge + nginx, waits for the image's own HEALTHCHECK, asserts
|
|
# over a socket, and tears the stack down on exit.
|
|
- name: Compose smoke — the scratch image
|
|
env:
|
|
# The CI overlay: the upstream config comes from the volume the step
|
|
# above filled. Compose reads COMPOSE_FILE itself, so the gate script
|
|
# stays the one an operator runs.
|
|
COMPOSE_FILE: docker-compose.yml:docker-compose.ci.yml
|
|
# Its own compose project and its own host port. The console job below
|
|
# brings up the same file, and on any machine where two jobs share one
|
|
# docker daemon (a self-hosted runner, a local act run) the default
|
|
# project name and the default 8080 make them the same stack: one
|
|
# job's `compose down` is the other's connection refused. Measured, not
|
|
# guessed — see the comment in docker-compose.yml.
|
|
COMPOSE_PROJECT_NAME: openwafci-scratch
|
|
EDGE_PORT: "8081"
|
|
EDGE: http://${{ env.OPENWAF_EDGE_HOST }}:8081
|
|
run: ./scripts/ci-gates.sh scratch-smoke
|
|
|
|
- name: README assertion counts match what the gate ran
|
|
run: ./scripts/ci-gates.sh readme-counts scripts/compose-smoke.sh
|
|
|
|
# The console is a page, and a page fails in ways curl cannot see: a typo in
|
|
# the inline script, a fetch that 401s, a table that renders nothing while the
|
|
# summary looks fine. This drives it in a real Chromium.
|
|
#
|
|
# Honest status: on the Gitea runner (run 2316) this job reached the gate and
|
|
# died at `- starting the stack / compose up failed`, exit 7 — the missing
|
|
# docker CLI, not the page. The playwright half of it did work there:
|
|
# playwright@1.63.0 installed and Chrome Headless Shell 153.0.8010.12
|
|
# (chromium-headless-shell v1243) downloaded to /root/.cache/ms-playwright.
|
|
# It has also run start to finish in a local Actions-compatible runner (act,
|
|
# catthehacker/ubuntu:act-latest):
|
|
# the pinned playwright@1.63.0 installed, chromium-1243 downloaded, the gate
|
|
# reported 33 assertions / 0 failed, and the screenshot step published the
|
|
# artifact (console-evidence.png 335998 bytes, console-evidence.phone.png
|
|
# 264597 bytes). Locally the same gate passes with playwright-core 1.62.1 when
|
|
# that is the browser the machine already holds — the version the log names is
|
|
# the version that ran. Its control (a missing playwright-core) exits 2, and a
|
|
# wrong token exits 1, rather than reporting success. The step calls the gate
|
|
# by name rather than retyping the script, so the CI definition and the
|
|
# operator command cannot drift.
|
|
console:
|
|
name: the operator page in a real browser
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
# The gate below talks to docker, and the runner's job image does not ship
|
|
# the docker CLI. Measured, not guessed: the first real run of this file
|
|
# (Gitea Actions run 2316, head 6f92d37) died here with
|
|
# `./scripts/ci-gates.sh: line 44: docker: command not found`, exit 127.
|
|
# /var/run/docker.sock is mounted from the host, so what is missing is the
|
|
# client side: the CLI, the compose v2 plugin, and buildx — `docker compose
|
|
# up --build` reaches the daemon through buildx, so the compose plugin alone
|
|
# does not bring this stack up. The same install the neemle-landing
|
|
# pipeline on this instance uses. Pinned to the Debian bookworm docker.com
|
|
# repo so the version does not drift with the image.
|
|
- 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
|
|
# compose-smoke.sh calls `docker compose`, and every command in it
|
|
# talks to the host daemon over the mounted socket. A missing socket is
|
|
# an infrastructure answer, so it says so here rather than failing
|
|
# three steps later as a broken product.
|
|
docker --version
|
|
docker compose version
|
|
docker buildx version
|
|
[ -S /var/run/docker.sock ] || { echo "no /var/run/docker.sock on this runner"; exit 1; }
|
|
docker info --format 'daemon {{.ServerVersion}} on {{.OperatingSystem}}'
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
|
|
# Pinned to a version that exists in the registry at the time of writing
|
|
# (checked with `npm view playwright version`), and the browser is
|
|
# installed for that exact version.
|
|
- name: Install playwright (pinned) and chromium
|
|
run: |
|
|
npm init -y >/dev/null
|
|
npm install --no-save playwright@1.63.0
|
|
npx playwright install --with-deps chromium
|
|
echo "PLAYWRIGHT_CORE=$(node -e 'console.log(require.resolve("playwright-core"))')" >> "$GITHUB_ENV"
|
|
|
|
# The nginx config reaches the upstream container through a named volume
|
|
# here, not through a workspace path — docker-compose.ci.yml explains why
|
|
# (the host daemon cannot see the job container's workspace). Compose names
|
|
# the volume after the project, so the name is built, not guessed.
|
|
- name: Put the upstream config where the host daemon can see it
|
|
env:
|
|
COMPOSE_PROJECT_NAME: openwafci-console
|
|
run: |
|
|
set -eu
|
|
VOL="${COMPOSE_PROJECT_NAME}_openwaf-upstream-conf"
|
|
# A run that died mid-scene leaves its bans in the stack's data volume:
|
|
# `compose down` keeps named volumes, and the runner reuses the same
|
|
# project name every push. Measured on run 2361, where the 502-upstream
|
|
# scene opened with the source already banned (expected 502, got 403)
|
|
# because runs 2350 and 2355 left state behind. The gate's own scenes
|
|
# rely on data outliving `compose down`, so the clean has to happen
|
|
# before the stack starts, not in its teardown.
|
|
docker volume rm "${COMPOSE_PROJECT_NAME}_openwaf-data" \
|
|
"${COMPOSE_PROJECT_NAME}_openwaf-geoip" >/dev/null 2>&1 || true
|
|
docker volume create "$VOL" >/dev/null
|
|
docker run --rm -i -v "$VOL:/conf" busybox:1.37 sh -c 'cat > /conf/default.conf' < deploy/upstream.conf
|
|
docker run --rm -v "$VOL:/conf" busybox:1.37 sh -c 'wc -c /conf/default.conf'
|
|
|
|
# The second half of the same asymmetry: compose publishes the edge's port on
|
|
# the HOST, while the job that curls it lives in its own network namespace, so
|
|
# 127.0.0.1:<port> is refused there. Measured on run 2350: the edge container
|
|
# reached `healthy`, and the gate's first admin call died with curl exit 7.
|
|
# The default-route address of the job container is the host's own address on
|
|
# that network, and compose publishes on 0.0.0.0, so that is the address the
|
|
# gate has to be pointed at. (tskr solves the same platform quirk by running
|
|
# its gates in sibling containers — see docker/test/workspace-mount.sh there.)
|
|
- name: Name the address the job can reach the published ports on
|
|
run: |
|
|
set -eu
|
|
# `ip` is not in this image (measured: `ip: command not found`, exit 127),
|
|
# so the route is read from the kernel's own table. The gateway there is
|
|
# hex, little-endian, and bash turns it back into dotted quad.
|
|
GWHEX=$(awk '$2=="00000000" {print $3; exit}' /proc/net/route)
|
|
[ -n "$GWHEX" ] || { echo "no default route in /proc/net/route"; exit 1; }
|
|
GW=$(printf '%d.%d.%d.%d' "0x${GWHEX:6:2}" "0x${GWHEX:4:2}" "0x${GWHEX:2:2}" "0x${GWHEX:0:2}")
|
|
echo "OPENWAF_EDGE_HOST=$GW" >> "$GITHUB_ENV"
|
|
echo "the gate will ask the edge at $GW"
|
|
|
|
- name: Console smoke — the page, not only its endpoints
|
|
env:
|
|
# Written into the job's workspace so the next step can publish it.
|
|
# A green console job with no picture leaves nothing to inspect once
|
|
# the runner is gone; a red one leaves the reviewer the page as it
|
|
# broke. console-check.cjs writes <path> and <path>.phone.png.
|
|
SCREENSHOT: console-evidence.png
|
|
# See the compose-smoke step: a separate project and port, so the two
|
|
# jobs cannot tear down each other's stack.
|
|
COMPOSE_PROJECT_NAME: openwafci-console
|
|
COMPOSE_FILE: docker-compose.yml:docker-compose.ci.yml
|
|
EDGE_PORT: "8090"
|
|
EDGE: http://${{ env.OPENWAF_EDGE_HOST }}:8090
|
|
run: ./scripts/ci-gates.sh console
|
|
|
|
- name: README assertion counts match what the gate ran
|
|
run: ./scripts/ci-gates.sh readme-counts scripts/console-check.cjs
|
|
|
|
# Not an artifact upload, and that is a measurement rather than a
|
|
# preference. Run 2370 (head 36d9338) drove the page through every
|
|
# assertion — `console check: all assertions passed` — and the job still
|
|
# went red one step later: `actions/upload-artifact@v4` reports
|
|
# `@actions/artifact v2.0.0+, upload-artifact@v4+ and download-artifact@v4+
|
|
# are not currently supported on GHES`, which is what Gitea's runner looks
|
|
# like to that action. The other pipeline on this instance says the same
|
|
# thing about the same instance: "actions/upload-artifact is not mirrored on
|
|
# git.vezha.io" (tskr, .gitea/workflows/ci.yml). So the evidence this job
|
|
# owes is in the log: the gate already prints every assertion with the value
|
|
# it read, and the step below names each screenshot with its size and hash
|
|
# so a reader can tell which picture the log describes.
|
|
- name: Report the console screenshots
|
|
if: always()
|
|
run: |
|
|
set -eu
|
|
seen=0
|
|
for f in console-evidence.png console-evidence.phone.png; do
|
|
if [ -f "$f" ]; then
|
|
seen=1
|
|
printf 'screenshot %s - %s bytes - sha256 %s\n' \
|
|
"$f" "$(wc -c < "$f" | tr -d ' ')" "$(sha256sum "$f" | cut -d' ' -f1)"
|
|
fi
|
|
done
|
|
[ "$seen" -eq 1 ] || echo "no screenshot was written: the gate never reached the page"
|