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"