Skip to content

Commit 0104233

Browse files
sbryngelsonclaude
andcommitted
ci: reduce to 2 attempts, nuke build dir on retry
Replace 3-attempt loops with 2 attempts everywhere. On the single retry, nuke the entire build directory rather than partial cleanup. Applies to retry_build() in retry-build.sh, nick-fields/retry in test.yml (Build and Pre-Build steps), and bench.yml Setup & Build. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 24f25f3 commit 0104233

3 files changed

Lines changed: 13 additions & 29 deletions

File tree

.github/scripts/retry-build.sh

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,13 @@
11
#!/bin/bash
2-
# Provides retry_build(): 3-attempt loop with configurable cleanup.
3-
# Set RETRY_CLEAN_CMD to override cleanup (default: rm -rf build/staging build/install build/lock.yaml).
2+
# Provides retry_build(): 2-attempt loop.
3+
# On failure of attempt 1, nukes the entire build directory before attempt 2.
44
# Set RETRY_VALIDATE_CMD to run a post-build validation; failure triggers a retry.
55
# Usage: source .github/scripts/retry-build.sh
66
# retry_build ./mfc.sh build -j 8 --gpu acc
77

8-
_retry_clean() {
9-
local clean_cmd="$1"
10-
local attempt="${2:-1}"
11-
if [ "$attempt" -ge 2 ]; then
12-
echo " Attempt $attempt failed — nuking entire build directory for a clean retry."
13-
rm -rf build 2>/dev/null || true
14-
return 0
15-
fi
16-
if eval "$clean_cmd" 2>/dev/null; then
17-
return 0
18-
fi
19-
echo " Cleanup failed; falling back to best-effort rm."
20-
rm -rf build/staging build/install build/lock.yaml 2>/dev/null || true
21-
}
22-
238
retry_build() {
24-
local clean_cmd="${RETRY_CLEAN_CMD:-rm -rf build/staging build/install build/lock.yaml}"
259
local validate_cmd="${RETRY_VALIDATE_CMD:-}"
26-
local max_attempts=3
10+
local max_attempts=2
2711
local attempt=1
2812
while [ $attempt -le $max_attempts ]; do
2913
echo "Build attempt $attempt of $max_attempts..."
@@ -32,7 +16,8 @@ retry_build() {
3216
if ! eval "$validate_cmd"; then
3317
echo "Post-build validation failed on attempt $attempt."
3418
if [ $attempt -lt $max_attempts ]; then
35-
_retry_clean "$clean_cmd" "$attempt"
19+
echo " Nuking build directory before retry..."
20+
rm -rf build 2>/dev/null || true
3621
sleep 5
3722
attempt=$((attempt + 1))
3823
continue
@@ -46,7 +31,8 @@ retry_build() {
4631
return 0
4732
fi
4833
if [ $attempt -lt $max_attempts ]; then
49-
_retry_clean "$clean_cmd" "$attempt"
34+
echo " Build failed — nuking build directory before retry..."
35+
rm -rf build 2>/dev/null || true
5036
sleep 30
5137
else
5238
echo "Build failed after $max_attempts attempts."

.github/workflows/bench.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ jobs:
106106
if: matrix.build_script != ''
107107
uses: nick-fields/retry@v3
108108
with:
109-
max_attempts: 3
109+
max_attempts: 2
110110
retry_wait_seconds: 60
111111
timeout_minutes: 150
112112
command: |
@@ -118,9 +118,7 @@ jobs:
118118
wait $pid2; e2=$?
119119
[ $e1 -eq 0 ] && [ $e2 -eq 0 ]
120120
on_retry_command: |
121-
(cd pr && ./mfc.sh clean) &
122-
(cd master && ./mfc.sh clean) &
123-
wait
121+
rm -rf pr/build master/build
124122
125123
- name: Bench (Master v. PR)
126124
run: bash pr/.github/scripts/run_parallel_benchmarks.sh ${{ matrix.device }} ${{ matrix.interface }} ${{ matrix.cluster }}

.github/workflows/test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,11 @@ jobs:
249249
if: matrix.cluster != 'phoenix'
250250
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
251251
with:
252-
max_attempts: 3
252+
max_attempts: 2
253253
retry_wait_seconds: 60
254254
timeout_minutes: 60
255255
command: bash .github/workflows/${{ matrix.cluster }}/build.sh ${{ matrix.device }} ${{ matrix.interface }}
256-
on_retry_command: ./mfc.sh clean
256+
on_retry_command: rm -rf build
257257

258258
- name: Test
259259
run: bash .github/workflows/${{ matrix.cluster }}/submit.sh .github/workflows/${{ matrix.cluster }}/test.sh ${{ matrix.device }} ${{ matrix.interface }} ${{ matrix.shard }}
@@ -340,11 +340,11 @@ jobs:
340340
if: matrix.cluster != 'phoenix'
341341
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
342342
with:
343-
max_attempts: 3
343+
max_attempts: 2
344344
retry_wait_seconds: 60
345345
timeout_minutes: 120
346346
command: bash .github/scripts/prebuild-case-optimization.sh ${{ matrix.cluster }} ${{ matrix.device }} ${{ matrix.interface }}
347-
on_retry_command: ./mfc.sh clean
347+
on_retry_command: rm -rf build
348348

349349
- name: Run Case-Optimization Tests
350350
run: bash .github/workflows/${{ matrix.cluster }}/submit.sh .github/scripts/run_case_optimization.sh ${{ matrix.device }} ${{ matrix.interface }}

0 commit comments

Comments
 (0)