Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions scripts/fleet-report-back-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ for c in $crates; do
done

if [ -n "$pa_sha" ]; then
# A reused --bin-dir may hold a panic-attack from an earlier run. Only this
# run's install or cache restore may put one there.
rm -f "$bindir/panic-attack"
root="$HOME/.panic-attack"; bin="$root/bin/panic-attack"
group "panic-attack at $pa_sha"
if [ -x "$bin" ] && grep -qF "#$pa_sha" "$root/.crates.toml" 2>/dev/null; then
Expand All @@ -118,6 +121,10 @@ if [ -n "$pa_sha" ]; then
fi

if [[ -n "$pons_sha" ]]; then
# A reused --bin-dir may hold a pons from an earlier run, which ponsbot would
# find on PATH. Remove it before deciding, so a refused, failed or skipped
# install leaves no pons at all and ponsbot reads not_run.
rm -f "$bindir/pons"
if ! [[ "$pons_sha" =~ ^[0-9a-f]{40}$ ]]; then
warn "pons not installed" "$(printf '%q' "$pons_sha") is not a 40-hex commit; ponsbot will read not_run"
elif pin_commit=$(sed -n 's/^commit[[:space:]]*=[[:space:]]*"\([0-9a-f]\{40\}\)"[[:space:]]*$/\1/p' "$fleet/bots/ponsbot/canon/pin.toml" 2>/dev/null | head -n 1 || true); [[ -z "$pin_commit" ]]; then
Expand Down
10 changes: 10 additions & 0 deletions tests/fleet-report-back-build-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,16 @@ check "pons: an unreadable pin installs nothing and says so" "0 yes" \
run_pons_build pons-budget --pons "$PSHA" --build-budget 0
check "pons: a spent build budget skips the install with a warning" "0 yes" \
"$(grep -c . "$FLEET_PONS_CALLS" || true) $(grep -q 'spent before its turn' "$TMP/pons-budget.log" && echo yes || echo no)"
# A reused --bin-dir: a pons left by an earlier run must not survive a refusal.
mkdir -p "$TMP/pons-stale"; printf "#!/usr/bin/env bash\necho stale\n" > "$TMP/pons-stale/pons"; chmod +x "$TMP/pons-stale/pons"
run_pons_build pons-stale --pons 0123456789abcdef0123456789abcdef01234567
check "pons: a refused pin removes a stale pons from a reused bin dir" "" "$(files "$TMP/pons-stale")"
mkdir -p "$TMP/pons-stale-ok"; printf "#!/usr/bin/env bash\necho stale\n" > "$TMP/pons-stale-ok/pons"; chmod +x "$TMP/pons-stale-ok/pons"
run_pons_build pons-stale-ok --pons "$PSHA"
check "pons: ...and an accepted pin replaces it with this run's build" pons "$("$TMP/pons-stale-ok/pons")"
mkdir -p "$TMP/pa-stale"; printf "#!/usr/bin/env bash\necho stale\n" > "$TMP/pa-stale/panic-attack"; chmod +x "$TMP/pa-stale/panic-attack"
run_build pa-stale --crates "" --panic-attack 0123456789abcdef0123456789abcdef01234567 --build-budget 0
check "panic-attack: a skipped install removes a stale binary from a reused bin dir" "" "$(files "$TMP/pa-stale")"
echo
echo "fleet-report-back-build-test: $pass passed, $fail failed"
[ "$fail" -eq 0 ]
Loading