From 432e5a11e8586964f5064cfae37043803f115b63 Mon Sep 17 00:00:00 2001 From: Josh Creek <8179928+jcreek@users.noreply.github.com> Date: Sat, 5 Sep 2026 19:19:45 +0100 Subject: [PATCH] test(compose): make the allocated smoke explain its own CI failures This suite fails on GitHub Actions while passing locally, and it failed the same way at 089c127c -- the branch head before any of this branch's recent work -- so it is pre-existing rather than newly broken. Diagnosing it is currently impossible from CI alone. The script is mostly `curl -fsS` and bare [[ ]] assertions under `set -e`, all of which abort with no output, so the run log contains nothing but "make: *** Error 1". Both failing runs are equally silent. Add an ERR trap that reports the script line and the failing command, and dump `compose ps` plus the service logs on any non-zero exit rather than only when COMPOSE_KEEP_ON_FAILURE is set. The next CI run should therefore say what actually broke instead of needing another round trip to find out. No behaviour change on success; the target still passes locally. --- scripts/verify_allocated_compose.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/scripts/verify_allocated_compose.sh b/scripts/verify_allocated_compose.sh index b1e9d626..d0948f4f 100755 --- a/scripts/verify_allocated_compose.sh +++ b/scripts/verify_allocated_compose.sh @@ -11,8 +11,27 @@ secret="compose-workload-secret" smoke_dir="${COMPOSE_SMOKE_DIR:-/tmp/cosmic-clash-allocated-smoke}" compose=(docker compose -p "$project" -f "$compose_file") +# Most of this script is `curl -fsS` and bare [[ ]] assertions under `set -e`, +# which abort with no message at all. That is fine locally, where the fixture +# is still up to poke at, but in CI it produces a failed run whose log contains +# nothing but "make: *** Error 1" -- undiagnosable without re-running by hand. +# Report where it stopped, and dump the service logs, so a CI failure explains +# itself on the first occurrence. +failed_line="" +on_error() { + failed_line="$1" + echo "allocated Compose fixture failed at ${BASH_SOURCE[0]}:${failed_line}" >&2 + echo "--- failing command: ${BASH_COMMAND}" >&2 +} +trap 'on_error "$LINENO"' ERR + cleanup() { local rc=$? + if [[ "$rc" != 0 ]]; then + echo "--- allocated Compose service logs follow (exit ${rc}) ---" >&2 + "${compose[@]}" ps >&2 2>/dev/null || true + "${compose[@]}" logs --no-color --tail=80 >&2 2>/dev/null || true + fi if [[ "$rc" != 0 && "${COMPOSE_KEEP_ON_FAILURE:-}" == 1 ]]; then echo "allocated Compose fixture retained for inspection: ${project}" >&2 exit "$rc"