mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-08 11:46:35 +00:00
Extend the 'meta roles applications complexity' report: - --sort takes comma-separated multi-key clauses with per-key direction (e.g. 'desc embeds, asc weight'); replaces --order. - --variant lists one row per meta/variants.yml variant; --format adds yaml. - New columns: weight (was total), random, id, row, variants, bundles, jobs, lifecycle, covered_by, compose, swarm. - covered_by marks the first green (1-based id) different-role predecessor that embeds the row; variant>0 never covered. - bundles is the compose bundle/job count (whole-role) or 1 (per variant); jobs is the running sum. - compose/swarm reflect the CI test-deploy skip logic (invokable + tested lifecycle + per-mode skip + swarm deployable variant). - --filter is a boolean expression DSL (%% == \!= < > <= >=, and/or/xor/not, parens, set literals) over row fields. Add shared SPOTs: variant_bundles.compose_bundle_counts and variant_status.deployable_variant_indices, reused by the swarm/compose matrix. Update roundtrip.sh/md to --sort "desc weight". Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
62 lines
2.1 KiB
Bash
Executable File
62 lines
2.1 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 base cluster
|
|
# (complexity --unique), 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" --unique --format string)"
|
|
fi
|
|
[ -n "${apps// /}" ] || {
|
|
echo "roundtrip: no roles to run" >&2
|
|
exit 2
|
|
}
|
|
|
|
modes="${modes:-compose swarm}"
|
|
_log_dir="${TMPDIR:-/tmp}"
|
|
|
|
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"
|
|
grep -q "Matrix-deploy ${app}: provision/deploy/e2e/verify per round" "$log" || {
|
|
echo "roundtrip: ${app} [swarm] FAILED: swarm deploy job did not run (empty matrix); see ${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}]"
|