Files
aevolution/tools/ci/server-image-smoke.sh
dingoandClaude Opus 5.5 54beceb823 feat(admin): read-only admin portal and API (ADR-0182 step 1, schema 61)
evo-admin-api serves the portal at srs.aeternalisgames.com and read-only JSON
for world 100 behind Keycloak (realm role aevolution-admin, audience
aevolution-admin, client aevolution-admin-portal): accounts with session,
status, lives, deaths, resets and mutation choices; one account's lives; the
world's regions; and a live 2D region view of cells, wildlife, pools and
bubbles. The portal is plain HTML/CSS/JS with PKCE sign-in, a strict CSP and
no third-party code.

- Schema 61: three bounded SECURITY DEFINER read functions, fenced in the
  privilege audit; no table or existing function changes.
- Cellular regions answer GET /admin/view on the ops port (NetworkPolicy:
  Prometheus and the admin portal only); CellularLives::extent_of reads the
  existing phenotype budget. No simulation, checkpoint or wire change.
- TokenVerifier takes an optional realm role and returns the email; the ops
  server's response bound is configurable (16 KiB default unchanged).
- DEV component admin-portal-dev (Deployment, Service, NetworkPolicies); the
  Ingress and the aevolution-admin-pg Secret are created out of band.
- CI scripts pinned to schema 60 now expect 61.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 12:39:28 -04:00

51 lines
2.1 KiB
Bash

#!/usr/bin/env bash
# Smoke test for the evo-server image (M7.8, ADR-0066). Runs the image with the
# same restrictions a cluster uses; no network, no credentials, read-only root.
set -euo pipefail
image="${1:?image reference}"
run() {
docker run --rm --network none --read-only --cap-drop ALL \
--security-opt no-new-privileges "$@"
}
# Without configuration the server refuses to start (usage, exit 2), and never
# falls back to any default region or database.
set +e
usage="$(run "$image" 2>&1)"
code=$?
set -e
if [[ "$code" -ne 2 ]] || ! grep -q '^usage: evo-server ' <<<"$usage"; then
printf 'evo-server smoke failed (exit %s):\n%s\n' "$code" "$usage" >&2
exit 1
fi
# The bundled operations tool refuses to run without a subcommand too (M8.3).
set +e
tool="$(run --entrypoint /usr/local/bin/evo-world-clone "$image" 2>&1)"
code=$?
set -e
if [[ "$code" -ne 2 ]] || ! grep -q '^usage: evo-world-clone ' <<<"$tool"; then
printf 'evo-world-clone smoke failed (exit %s):\n%s\n' "$code" "$tool" >&2
exit 1
fi
# The admin API (ADR-0182) refuses to start without configuration, and its portal files ship.
set +e
admin="$(run --entrypoint /usr/local/bin/evo-admin-api "$image" 2>&1)"
code=$?
set -e
if [[ "$code" -ne 2 ]] || ! grep -q '^usage: evo-admin-api ' <<<"$admin"; then
printf 'evo-admin-api smoke failed (exit %s):\n%s\n' "$code" "$admin" >&2
exit 1
fi
# Non-root, every shared library resolved, no credential material in the image.
run --entrypoint /bin/sh "$image" -c '
set -eu
test "$(id -u)" = 10001 && test "$(id -g)" = 10001
! ldd /usr/local/bin/evo-server | grep -q "not found"
! ldd /usr/local/bin/evo-world-clone | grep -q "not found"
! ldd /usr/local/bin/evo-admin-api | grep -q "not found"
for f in index.html app.js style.css; do test -s "/usr/local/share/evo-admin-portal/$f"; done
test -z "$(find / -xdev \( -name "*pgpass*" -o -name "pg_service.conf" -o -name "*.pem" \
-o -name "*.key" \) -not -path "/etc/ssl/*" -not -path "/usr/lib/ssl/*" \
-not -path "/usr/share/*" -print 2>/dev/null)"
'
echo "server image smoke passed: $image"