Skip to content

Commit 9cd51ca

Browse files
committed
ci(e2e): skip final cleanup on disposable PR runners
Destroying runner-local state after a completed suite can push the job past its deadline even though the runner is discarded. Keep cleanup between preparation attempts and for reused hosts instead. Fixes: 186547d ("test(e2e): run the merge-gating lanes on Talos containers") Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <[email protected]>
1 parent 91f03dd commit 9cd51ca

3 files changed

Lines changed: 31 additions & 37 deletions

File tree

‎.github/workflows/e2e-fork.yaml‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -771,21 +771,6 @@ jobs:
771771
name: cozyreport
772772
path: _out/cozyreport.tgz
773773
if-no-files-found: warn
774-
# Both halves, and in this order: the compose project owns the nodes and
775-
# the zpools outlive it.
776-
- name: Tear down sandbox
777-
if: always()
778-
run: |
779-
# Annotated, not fatal: same reasoning as the in-tree lane. The runner
780-
# is discarded after the job, so a dirty host has no next tenant, and
781-
# failing here would post the required "E2E Tests" status as a failure
782-
# indistinguishable from a real one.
783-
cleanup_rc=0
784-
make -C packages/core/testing SANDBOX_NAME=$SANDBOX_NAME delete-cluster-container || cleanup_rc=$?
785-
make -C packages/core/testing SANDBOX_NAME=$SANDBOX_NAME delete || true
786-
if [ "$cleanup_rc" -ne 0 ]; then
787-
echo "::error title=sandbox teardown::teardown exited $cleanup_rc; the host may hold a stale compose project or zpool"
788-
fi
789774

790775
# Flip the pending "E2E Tests" commit status posted by `resolve` to its
791776
# terminal state. Runs on failure too, so a failed publish or e2e turns the

‎.github/workflows/pull-requests.yaml‎

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,28 +1348,6 @@ jobs:
13481348
Resume from inside: `breakpoint resume`. Otherwise the breakpoint
13491349
exits 10 minutes after the last SSH session disconnects.
13501350
1351-
# ▸ Tear down environment (always runs)
1352-
#
1353-
# Both halves, and in this order: the compose project owns the nodes and
1354-
# the zpools outlive it. A leftover pool makes the next run on a reused
1355-
# host adopt storage that already carries a dead cluster's volumes.
1356-
- name: Tear down sandbox
1357-
if: always()
1358-
run: |
1359-
# Loud, but never the job's verdict. A failed teardown means a dirty
1360-
# host, and this runner is discarded after the job, so there is no next
1361-
# run to protect -- while failing the job here posts the required
1362-
# "E2E Tests" status as a failure that no reader can tell apart from a
1363-
# real one. The annotation is what a reused host (a developer machine)
1364-
# needs; `delete-cluster-container` returning non-zero is not evidence
1365-
# about the product.
1366-
cleanup_rc=0
1367-
make -C packages/core/testing SANDBOX_NAME=$SANDBOX_NAME delete-cluster-container || cleanup_rc=$?
1368-
make -C packages/core/testing SANDBOX_NAME=$SANDBOX_NAME delete || true
1369-
if [ "$cleanup_rc" -ne 0 ]; then
1370-
echo "::error title=sandbox teardown::teardown exited $cleanup_rc; the host may hold a stale compose project or zpool"
1371-
fi
1372-
13731351
# Report the required "E2E Tests" gate as a commit status rather than relying
13741352
# on a job named "E2E Tests". A required *job* that is skipped counts
13751353
# as PASSED by branch protection — desired for docs-only PRs, but the exact

‎hack/cozyreport.bats‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,37 @@ STUB
966966
}
967967
}
968968

969+
@test "PR E2E jobs clean up between preparation attempts but not after testing" {
970+
tmp="$(mktemp -d)"
971+
mkdir -p "$tmp/bin"
972+
cat >"$tmp/bin/make" <<'STUB'
973+
#!/bin/sh
974+
printf '%s\n' "$*" >>"$CLEANUP_CALLS"
975+
case "$*" in
976+
*prepare-env-container*)
977+
if [ ! -f "$CLEANUP_ATTEMPT" ]; then
978+
touch "$CLEANUP_ATTEMPT"
979+
exit 1
980+
fi
981+
;;
982+
esac
983+
STUB
984+
chmod +x "$tmp/bin/make"
985+
for wf in pull-requests e2e-fork; do
986+
workflow="$HACK_DIR/../.github/workflows/$wf.yaml"
987+
yq --unwrapScalar '.jobs.e2e.steps[] | select(.name == "Prepare environment") | .run' "$workflow" >"$tmp/prepare.sh"
988+
CLEANUP_CALLS="$tmp/$wf.calls" CLEANUP_ATTEMPT="$tmp/$wf.attempt" SANDBOX_NAME=test PATH="$tmp/bin:$PATH" bash -eu "$tmp/prepare.sh"
989+
printf '%s\n' 'SANDBOX_NAME=test prepare-env-container' '-C packages/core/testing SANDBOX_NAME=test delete-cluster-container' 'SANDBOX_NAME=test prepare-env-container' >"$tmp/expected"
990+
diff "$tmp/expected" "$tmp/$wf.calls"
991+
scripts="$(yq --unwrapScalar '.jobs.e2e.steps[] | select(.name != "Prepare environment") | .run // ""' "$workflow")"
992+
if printf '%s\n' "$scripts" | grep -Eq 'delete-cluster-container|docker[[:space:]]+(compose.*down|rm)|zpool[[:space:]]+destroy|make.*[[:space:]]delete([[:space:]]|$)'; then
993+
echo "FAIL: $wf destroys runner-local state outside preparation"
994+
false
995+
fi
996+
done
997+
rm -rf "$tmp"
998+
}
999+
9691000
@test "the step that runs this collector has a ceiling of its own everywhere" {
9701001
# Every bound inside the script protects one read. None of them protects the
9711002
# STEP: the tarball is written on the collector's last line, the upload is the

0 commit comments

Comments
 (0)