forked from heavy-duty/rig
feat(drill): the record cites the rig-templates SHA the converge read (#110)
Override via RIG_TEMPLATES_REF when the drill was pointed somewhere; else the pin read from the INSTALLED candidate tree — what actually landed, never this checkout's copy.
This commit is contained in:
parent
b99d08ea3d
commit
11b02eb070
2 changed files with 27 additions and 0 deletions
|
|
@ -51,6 +51,14 @@ REPO="${RIG_REPO:-heavy-duty/rig}"
|
||||||
REF="${RIG_REF:-}"
|
REF="${RIG_REF:-}"
|
||||||
BOXREPO="${BOX_REPO:-heavy-duty/box}"
|
BOXREPO="${BOX_REPO:-heavy-duty/box}"
|
||||||
BOXREF="${BOX_REF:-}"
|
BOXREF="${BOX_REF:-}"
|
||||||
|
# The template registry the converge will read (#110). No explicitness
|
||||||
|
# demand here, unlike the two refs above: the DEFAULT is already a pin — the
|
||||||
|
# candidate tree's RIG_TEMPLATES_PIN, read after install from what actually
|
||||||
|
# landed — so an unset override means "the ref the release will really use",
|
||||||
|
# not "whatever main was that afternoon".
|
||||||
|
TPLREPO="${RIG_TEMPLATES_REPO:-heavy-duty/rig-templates}"
|
||||||
|
TPLREF="${RIG_TEMPLATES_REF:-}"
|
||||||
|
TPL_SHA=""
|
||||||
ROLE=staging-server
|
ROLE=staging-server
|
||||||
USERS_FILE="${DRILL_USERS_FILE:-}"
|
USERS_FILE="${DRILL_USERS_FILE:-}"
|
||||||
RUN_ID="${DRILL_RUN_ID:-drill-$(date -u +%F)}"
|
RUN_ID="${DRILL_RUN_ID:-drill-$(date -u +%F)}"
|
||||||
|
|
@ -266,6 +274,8 @@ emit_record() {
|
||||||
printf 'Run ID: %s. Host: %s, %s vCPU / %s GB RAM (%s).\n' "$RUN_ID" "${os:-unknown}" "$cpus" "$ram" "$virt"
|
printf 'Run ID: %s. Host: %s, %s vCPU / %s GB RAM (%s).\n' "$RUN_ID" "${os:-unknown}" "$cpus" "$ram" "$virt"
|
||||||
printf 'Candidate refs: rig@%s (RIG_REF=%s), box@%s (BOX_REF=%s).\n' \
|
printf 'Candidate refs: rig@%s (RIG_REF=%s), box@%s (BOX_REF=%s).\n' \
|
||||||
"${RIG_SHA:-unresolved}" "$REF" "${BOX_SHA:-unresolved}" "$BOXREF"
|
"${RIG_SHA:-unresolved}" "$REF" "${BOX_SHA:-unresolved}" "$BOXREF"
|
||||||
|
printf 'Template registry: %s@%s (ref %s) — the rig-templates the converge read (#110).\n' \
|
||||||
|
"${TPLREPO:-heavy-duty/rig-templates}" "${TPL_SHA:-unresolved}" "${TPLREF:-unresolved}"
|
||||||
printf 'Instrument: drill/drill.sh, legs in execution order.\n\n'
|
printf 'Instrument: drill/drill.sh, legs in execution order.\n\n'
|
||||||
printf '| Leg | Result |\n'
|
printf '| Leg | Result |\n'
|
||||||
printf '| --- | --- |\n'
|
printf '| --- | --- |\n'
|
||||||
|
|
@ -378,6 +388,21 @@ RIG_TREE="$(tree_of "$(command -v rig)")"
|
||||||
assert_installed_from rig "$RIG_TREE" "$REPO@$REF" || exit 1
|
assert_installed_from rig "$RIG_TREE" "$REPO@$REF" || exit 1
|
||||||
DRILL_VERSION="$(head -n1 "$RIG_TREE/VERSION" 2>/dev/null || echo unknown)"
|
DRILL_VERSION="$(head -n1 "$RIG_TREE/VERSION" 2>/dev/null || echo unknown)"
|
||||||
ok "installed tree confirms: $REPO@$REF (version $DRILL_VERSION)"
|
ok "installed tree confirms: $REPO@$REF (version $DRILL_VERSION)"
|
||||||
|
|
||||||
|
# The rig-templates ref this candidate converges (#110), for the record: the
|
||||||
|
# env override when the drill was pointed somewhere, else the pin read from
|
||||||
|
# the INSTALLED tree — what actually landed, never this checkout's copy. A
|
||||||
|
# 40-hex ref IS its own SHA (the pin's normal shape); anything else resolves
|
||||||
|
# through ref_sha like the two candidates above.
|
||||||
|
if [ -z "$TPLREF" ]; then
|
||||||
|
TPLREF="$(sed -n 's/^RIG_TEMPLATES_PIN=//p' "$RIG_TREE/commands/lib/templates.sh" 2>/dev/null | head -n1)"
|
||||||
|
fi
|
||||||
|
if [[ "$TPLREF" =~ ^[0-9a-f]{40}$ ]]; then
|
||||||
|
TPL_SHA="${TPLREF:0:7}"
|
||||||
|
elif [ -n "$TPLREF" ]; then
|
||||||
|
TPL_SHA="$(ref_sha "$TPLREPO" "$TPLREF")"
|
||||||
|
fi
|
||||||
|
inf "templates: $TPLREPO@${TPLREF:-unresolved} (${TPL_SHA:-unresolved})"
|
||||||
[ -n "$RECORD" ] || RECORD="$ROOT/drills/$DRILL_VERSION.md"
|
[ -n "$RECORD" ] || RECORD="$ROOT/drills/$DRILL_VERSION.md"
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
|
||||||
|
|
@ -159,6 +159,7 @@ check "…and the diff names the drifted sshd keyword, not just 'differs'" 1 "pa
|
||||||
emit() { # emit <outfile> — emit_record with the harness globals staged
|
emit() { # emit <outfile> — emit_record with the harness globals staged
|
||||||
DRILL_VERSION="9.9.9" RUN_ID="drill-2026-01-01-a" \
|
DRILL_VERSION="9.9.9" RUN_ID="drill-2026-01-01-a" \
|
||||||
REF="release/9.9.9" BOXREF="release/0.4.0" RIG_SHA="5d6e7f8" BOX_SHA="1a2b3c4" \
|
REF="release/9.9.9" BOXREF="release/0.4.0" RIG_SHA="5d6e7f8" BOX_SHA="1a2b3c4" \
|
||||||
|
TPLREPO="heavy-duty/rig-templates" TPLREF="9f8e7d6c5b4a39281706f5e4d3c2b1a098765432" TPL_SHA="9f8e7d6" \
|
||||||
bash -c '
|
bash -c '
|
||||||
. "$1"
|
. "$1"
|
||||||
pass=12 fail=1 skipped=1
|
pass=12 fail=1 skipped=1
|
||||||
|
|
@ -173,6 +174,7 @@ check "record: the version-and-date heading" 0 "# Release drill — 9.9.9 — "
|
||||||
check "record: the run ID that joins the family's records" 0 "Run ID: drill-2026-01-01-a" cat "$WORK/record.md"
|
check "record: the run ID that joins the family's records" 0 "Run ID: drill-2026-01-01-a" cat "$WORK/record.md"
|
||||||
check "record: both pinned refs with their SHAs" 0 "rig@5d6e7f8 (RIG_REF=release/9.9.9)" cat "$WORK/record.md"
|
check "record: both pinned refs with their SHAs" 0 "rig@5d6e7f8 (RIG_REF=release/9.9.9)" cat "$WORK/record.md"
|
||||||
check "record: …box's too" 0 "box@1a2b3c4 (BOX_REF=release/0.4.0)" cat "$WORK/record.md"
|
check "record: …box's too" 0 "box@1a2b3c4 (BOX_REF=release/0.4.0)" cat "$WORK/record.md"
|
||||||
|
check "record: the template registry SHA rides alongside the pair (#110)" 0 "rig-templates@9f8e7d6 (ref 9f8e7d6c5b4a39281706f5e4d3c2b1a098765432)" cat "$WORK/record.md"
|
||||||
check "record: one table row per leg, result verbatim" 0 "| re-converge (idempotence) | clean, no changes |" cat "$WORK/record.md"
|
check "record: one table row per leg, result verbatim" 0 "| re-converge (idempotence) | clean, no changes |" cat "$WORK/record.md"
|
||||||
check "record: the numbers, skips counted apart from passes" 0 "12 passed, 1 failed, 1 skipped" cat "$WORK/record.md"
|
check "record: the numbers, skips counted apart from passes" 0 "12 passed, 1 failed, 1 skipped" cat "$WORK/record.md"
|
||||||
check "record: a FAILED run still names what failed (evidence, not success)" 0 "FAIL: coolify container state: absent" cat "$WORK/record.md"
|
check "record: a FAILED run still names what failed (evidence, not success)" 0 "FAIL: coolify container state: absent" cat "$WORK/record.md"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue