fix(ci): smoke test hung 14min — buildah run doesn't die under plain timeout
Bare `/tapir` runs the long-running server, same as the old ctr-based smoke test. ctr's --rm reliably force-killed it; a plain `timeout N buildah run` does not — it only signals the wrapper, and the container process can survive that and keep the log pipe open, hanging the whole job (observed live: run 155, 14min before failure). Backgrounds the run and tears it down with `buildah rm -f`, which forcibly kills regardless of wrapper state, and captures output via a file instead of a blocking pipe. Refs infra#132.
This commit is contained in:
+17
-2
@@ -82,13 +82,28 @@ jobs:
|
|||||||
# avoids sudo/host-containerd access so this still works once the
|
# avoids sudo/host-containerd access so this still works once the
|
||||||
# runner itself is containerized (infra#132). Tests the local
|
# runner itself is containerized (infra#132). Tests the local
|
||||||
# buildah-store image directly, no registry round-trip needed.
|
# buildah-store image directly, no registry round-trip needed.
|
||||||
|
#
|
||||||
|
# Bare `/tapir` (no subcommand) runs the long-running server, same as
|
||||||
|
# the old ctr-based smoke test -- ctr's --rm reliably force-killed it,
|
||||||
|
# but a plain `timeout N buildah run` does NOT: it only signals the
|
||||||
|
# `buildah run` wrapper, and the actual container process can survive
|
||||||
|
# that and keep the output pipe open, hanging the whole job (hit this
|
||||||
|
# live: 14min hang, infra#132). Backgrounding the run + `buildah rm -f`
|
||||||
|
# decouples "is the script blocked" from "did the process exit" --
|
||||||
|
# rm -f forcibly tears down the container regardless of wrapper state.
|
||||||
- name: Smoke test
|
- name: Smoke test
|
||||||
run: |
|
run: |
|
||||||
REGISTRY="localhost:5000"
|
REGISTRY="localhost:5000"
|
||||||
REF="${REGISTRY}/${{ env.IMAGE }}:${{ steps.meta.outputs.sha-tag }}"
|
REF="${REGISTRY}/${{ env.IMAGE }}:${{ steps.meta.outputs.sha-tag }}"
|
||||||
CONTAINER=$(buildah from ${REF})
|
CONTAINER=$(buildah from ${REF})
|
||||||
OUTPUT=$(timeout 5 buildah run "$CONTAINER" -- /tapir 2>&1 || true)
|
LOG=$(mktemp)
|
||||||
buildah rm "$CONTAINER" >/dev/null
|
buildah run "$CONTAINER" -- /tapir > "$LOG" 2>&1 &
|
||||||
|
RUNPID=$!
|
||||||
|
sleep 5
|
||||||
|
kill -9 "$RUNPID" 2>/dev/null || true
|
||||||
|
wait "$RUNPID" 2>/dev/null || true
|
||||||
|
buildah rm -f "$CONTAINER" >/dev/null 2>&1 || true
|
||||||
|
OUTPUT=$(cat "$LOG"); rm -f "$LOG"
|
||||||
echo "$OUTPUT" | grep -q "tapir" \
|
echo "$OUTPUT" | grep -q "tapir" \
|
||||||
&& echo "Smoke test passed" \
|
&& echo "Smoke test passed" \
|
||||||
|| echo "Smoke test inconclusive: $OUTPUT"
|
|| echo "Smoke test inconclusive: $OUTPUT"
|
||||||
|
|||||||
Reference in New Issue
Block a user