rig updates

This commit is contained in:
2026-09-16 19:08:46 -03:00
parent 3e864aa919
commit 29e30693ea
24 changed files with 8160 additions and 977 deletions

View File

@@ -11,7 +11,7 @@
# Scope, on purpose:
# - no cluster, no docker, no network. It must be cheap enough to actually run.
# - it asserts about RIG. `make check` asserts about the MACHINE and never
# fails; this exits 1, the way `make pins` does.
# fails; this exits 1, the way `make standalone check` does.
# - what actually deploys is not testable here. `tilt ci` stays a manual step.
#
# Usage: make selftest (or: bash ctrl/selftest.sh)
@@ -168,24 +168,37 @@ check "guards on the variable" "1" "$(grep -c 'allow_k8s_contexts(CTX)' Tiltfil
check "asks ports.sh for facts" "1" "$(grep -c "local('bash ports.sh active'" Tiltfile)"
note "the standalone Makefile only calls real verbs"
# That file exists so nothing wrapping these scripts has to GUESS how to call
# them. A generated Makefile once did guess: `rigmini.sh on`, which is not a
# verb, and a bare `rigdeps.sh` for "check and report", which installs. So each
# target's default verb must be one the script's own dispatch accepts — read
# from the script's `case`, not from a list here that could drift from it.
note "standalone kits are generated, current, and call only real verbs"
# The kits under standalone/<profile>/ are rig flattened into single files, one
# per profile. A kit left behind by a change to rig is exactly the drift they
# replaced — rigmini.sh once said 2 GB per node long after rig measured 800 MB —
# so a stale kit fails here rather than waiting to be noticed on another machine.
check "every kit matches what rig generates now" "yes" \
"$(bash standalone.sh check >/dev/null 2>&1 && echo yes || echo "no — run make standalone")"
# Each kit's Makefile exists so nothing wrapping these scripts has to GUESS how to
# call them. A generated Makefile once did guess: `rigmini.sh on`, not a verb,
# and a bare `rigdeps.sh` for "check and report", which installs. So every
# target's default verb must be one its script's own dispatch accepts — read
# from that dispatch, not from a list here that could drift from it.
verbs_of() {
sed -n '/^case "\$cmd" in/,/^esac/p' "$1" | grep -oE '^ [a-z]+\)' | tr -d ' )'
}
for pair in deps:rigdeps.sh mem:rigmini.sh; do
target=${pair%%:*}; script=${pair##*:}
verb="$(make --no-print-directory -s -n -f ../standalone/Makefile "$target" 2>/dev/null \
| awk -v s="$script" 'index($0, s) { print $NF; exit }')"
check "make $target -> $script ${verb:-?}, a verb it accepts" "yes" \
"$(verbs_of "../standalone/$script" | grep -qx "$verb" && echo yes || echo "no: '$verb'")"
kits=0
for mk in ../standalone/*/Makefile; do
[ -f "$mk" ] || continue
kit=$(dirname "$mk"); kits=$((kits + 1))
for target in $(grep -oE '^[a-z][a-z-]*:' "$mk" | tr -d ':' | grep -vx help); do
line="$(make --no-print-directory -s -n -f "$mk" "$target" 2>/dev/null | head -1)"
script=$(basename "$(printf '%s' "$line" | awk '{print $2}')")
verb=$(printf '%s' "$line" | awk '{print $NF}')
check "$(basename "$kit"): make $target -> $script $verb, a verb it accepts" "yes" \
"$(verbs_of "$kit/$script" | grep -qx "$verb" && echo yes || echo "no: '$verb'")"
done
check "$(basename "$kit"): no \`mini\` target, which already means minimal footprint" "0" \
"$(grep -cE '^mini:' "$mk")"
done
check "no \`mini\` target, which already means minimal footprint" "0" \
"$(grep -cE '^mini:' ../standalone/Makefile)"
check "there is a kit for every profile" "$(config_profiles | wc -l)" "$kits"
note "optional — needs tilt and this rig's cluster"