mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-13 22:26:49 +00:00
The swarm gate asked whether the drill ran by grepping the job log for "Matrix-deploy <app>: provision/deploy/e2e/verify per round" — a copy of a GitHub Actions step display name.d9a4498b3renamed that step to "🚀 Drill <apps> per distro: <distros>" and did not touch roundtrip.sh, so at19d56f07ethe literal existed in exactly one place in the tree: the grep itself. It could no longer match anything, and four of the five workspace legs of run 30586213932 false-failed on deploys that had passed — svc-db-postgres converged, answered on 5432, completed its DR drill and reported "Job succeeded" three lines above the failure. This is the second time the same coupling drifted.0ca2ed56cis titled "align roundtrip swarm gate to the live workflow step name" and records that the previous stale marker made every swarm leg false-fail on a passing deploy. Nothing cross-checked the literal, so it rots silently after each rename. The marker now comes from the drill itself, printed after 07_assert_state.sh. Every step before it runs under set -euo pipefail and the EXIT trap tears down without printing, so the line is unreachable unless the drill completed for that app. APP_ID and INFINITO_DISTRO are :?-guarded at the top of the script, so the marker cannot degrade into an empty string that matches everything. The gate matches it with grep -qF and names what it checked instead of asserting "empty matrix" — a diagnosis that was never true and sent this investigation into the wrong layer. The gate itself stays.214672a94added it because act exits 0 on a zero-leg matrix, which silently false-passed every local swarm roundtrip. tests/unit/scripts/test_roundtrip_marker.py pins emitter and gate to the same literal, pins the marker behind the state assertion, and fails if the old step name reappears — the cross-check whose absence allowed both drifts. Verified against the failing run's log: 0 occurrences of the old literal, while DR drill PASSED, ran=1 skipped=0 and "Job succeeded" prove the drill reached the point where the new marker is emitted. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
63 lines
2.2 KiB
Bash
Executable File
63 lines
2.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Iterate one or more roles through every deploy mode in order, stopping at the
|
|
# first failure. Inputs (env):
|
|
# apps - space-separated role ids; defaults to one role per dna cluster
|
|
# (complexity clone == false), most complex first, when unset
|
|
# modes - mode sequence (default "compose swarm"; append "k8s" here once it exists)
|
|
# keep - true keeps each validated swarm cluster instead of releasing it
|
|
_repo_root="$(cd "$(dirname "$0")/../../.." && pwd)"
|
|
|
|
# shellcheck source=scripts/meta/env/load.sh
|
|
. "${_repo_root}/scripts/meta/env/load.sh"
|
|
|
|
if [ -z "${apps:-}" ]; then
|
|
apps="$("${PYTHON}" -m cli.meta.roles.applications.complexity \
|
|
--sort "desc weight" --filter "clone == false" --format string)"
|
|
fi
|
|
[ -n "${apps// /}" ] || {
|
|
echo "roundtrip: no roles to run" >&2
|
|
exit 2
|
|
}
|
|
|
|
modes="${modes:-compose swarm}"
|
|
_log_dir="${TMPDIR:-/tmp}" # nocheck: posix TMPDIR convention
|
|
|
|
read -ra _apps <<<"${apps//$'\n'/ }"
|
|
read -ra _modes <<<"$modes"
|
|
|
|
for app in "${_apps[@]}"; do
|
|
app_skip="$("${PYTHON}" -c "import sys; sys.path.insert(0, '${_repo_root}'); from utils.roles.meta_lookup import get_role_skip; print(' '.join(get_role_skip('${app}')))")"
|
|
for mode in "${_modes[@]}"; do
|
|
if [[ " ${app_skip} " == *" ${mode} "* ]]; then
|
|
echo "==> roundtrip: ${app} [${mode}] SKIPPED (meta/services.yml skip)"
|
|
continue
|
|
fi
|
|
log="${_log_dir}/roundtrip-${app}-${mode}.log"
|
|
echo "==> roundtrip: ${app} [${mode}] (log: ${log})"
|
|
case "$mode" in
|
|
compose)
|
|
make -C "$_repo_root" compose-deploy \
|
|
mode=reinstall apps="$app" full_cycle=true variant=0 2>&1 | tee "$log"
|
|
;;
|
|
swarm)
|
|
ACT_PLATFORM_IMAGE=local/act-runner-fixed:latest \
|
|
make -C "$_repo_root" swarm-zombie app="$app" 2>&1 | tee "$log"
|
|
marker="==> swarm drill complete: app=${app}"
|
|
grep -qF "${marker}" "$log" || {
|
|
echo "roundtrip: ${app} [swarm] FAILED: swarm-zombie exited 0 but the drill never completed for ${app} (marker '${marker}' absent from ${log})" >&2
|
|
exit 1
|
|
}
|
|
[ "${keep:-false}" = true ] || make -C "$_repo_root" swarm-down name="$app"
|
|
;;
|
|
*)
|
|
echo "roundtrip: unknown mode '${mode}' (expected: compose | swarm)" >&2
|
|
exit 2
|
|
;;
|
|
esac
|
|
done
|
|
done
|
|
|
|
echo "==> roundtrip: all ${#_apps[@]} role(s) green across [${modes}]"
|