ci(smoke): best-effort cleanup for the Windows version/security preflight dirs

The version preflight PASSED (both images printed their version) and
then the job died in the cleanup trap: Windows keeps the just-exited
image's file busy for ~100ms (section teardown / first-touch AV), so
'rm -rf' in the EXIT trap raced it — 'Device or resource busy', exit 1
on a job whose actual work was green (observed on windows-11-arm ui in
dry run 30232946513). Temp-dir cleanup on an ephemeral runner is
best-effort with one retry, never a gate.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
This commit is contained in:
Martin Vogel
2026-07-27 06:31:40 +02:00
parent 657d4b0284
commit 7973f1aaec
+6 -2
View File
@@ -201,7 +201,10 @@ jobs:
# runner workspace is deliberately not a valid launcher bundle root.
PROFILE_ROOT="$(cygpath -u "$USERPROFILE")"
LAUNCH_DIR="$(mktemp -d "$PROFILE_ROOT/cbm-release-version.XXXXXX")"
trap 'rm -rf "$LAUNCH_DIR"' EXIT
# Best-effort cleanup with one retry: Windows holds the just-exited
# image's file busy for ~100ms (section teardown / first-touch AV),
# and a temp dir on an ephemeral runner must never fail the job.
trap 'rm -rf "$LAUNCH_DIR" 2>/dev/null || { sleep 2; rm -rf "$LAUNCH_DIR" 2>/dev/null || true; }' EXIT
cp "$ARTIFACT_DIR/codebase-memory-mcp.exe" \
"$ARTIFACT_DIR/codebase-memory-mcp.payload.exe" "$LAUNCH_DIR/"
"$LAUNCH_DIR/codebase-memory-mcp.payload.exe" --version
@@ -231,7 +234,8 @@ jobs:
scripts/security-strings.sh "$ARTIFACT_DIR/codebase-memory-mcp.payload.exe"
PROFILE_ROOT="$(cygpath -u "$USERPROFILE")"
SECURITY_DIR="$(mktemp -d "$PROFILE_ROOT/cbm-release-security.XXXXXX")"
trap 'rm -rf "$SECURITY_DIR"' EXIT
# Best-effort cleanup with one retry (see the version preflight).
trap 'rm -rf "$SECURITY_DIR" 2>/dev/null || { sleep 2; rm -rf "$SECURITY_DIR" 2>/dev/null || true; }' EXIT
cp "$ARTIFACT_DIR/codebase-memory-mcp.exe" \
"$ARTIFACT_DIR/codebase-memory-mcp.payload.exe" "$SECURITY_DIR/"
TMPDIR="$SECURITY_DIR" \