Skip to content

Commit c3a2469

Browse files
sbryngelsonclaude
andcommitted
Fix race conditions and cleanup in build cache
- Only remove build/staging (not build/install) on retry, so concurrent test jobs reading installed binaries are not disrupted - Remove stale symlink in lock-timeout fallback path to prevent writing into the shared cache without holding the lock - Remove redundant flock --unlock (closing fd is sufficient) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3738e14 commit c3a2469

4 files changed

Lines changed: 8 additions & 4 deletions

File tree

.github/scripts/setup-build-cache.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ if flock --timeout 3600 9; then
4848
else
4949
echo " WARNING: Cache lock timeout (1h), building locally without cache"
5050
exec 9>&-
51+
# Remove any existing symlink to the shared cache so we don't write
52+
# into it without the lock. Then create a real local directory.
53+
if [ -L "build" ]; then
54+
rm -f "build"
55+
fi
5156
mkdir -p "build"
5257
echo "========================="
5358
return 0 2>/dev/null || true

.github/workflows/frontier/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ while [ $attempt -le $max_attempts ]; do
4949

5050
if [ $attempt -lt $max_attempts ]; then
5151
echo "Build failed on attempt $attempt. Clearing staging/install and retrying in 30s..."
52-
rm -rf build/staging build/install build/lock.yaml
52+
rm -rf build/staging build/lock.yaml
5353
sleep 30
5454
fi
5555
attempt=$((attempt + 1))

.github/workflows/frontier_amd/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ while [ $attempt -le $max_attempts ]; do
4949

5050
if [ $attempt -lt $max_attempts ]; then
5151
echo "Build failed on attempt $attempt. Clearing staging/install and retrying in 30s..."
52-
rm -rf build/staging build/install build/lock.yaml
52+
rm -rf build/staging build/lock.yaml
5353
sleep 30
5454
fi
5555
attempt=$((attempt + 1))

.github/workflows/phoenix/test.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ while [ $attempt -le $max_attempts ]; do
2424

2525
if [ $attempt -lt $max_attempts ]; then
2626
echo "Build failed on attempt $attempt. Clearing staging/install and retrying in 30s..."
27-
rm -rf build/staging build/install build/lock.yaml
27+
rm -rf build/staging build/lock.yaml
2828
sleep 30
2929
else
3030
echo "Build failed after $max_attempts attempts."
@@ -36,7 +36,6 @@ done
3636
# Release the cache lock before running tests. Tests only read installed
3737
# binaries and can take hours — no need to block other builds.
3838
if [ "${_cache_locked:-false}" = true ]; then
39-
flock --unlock 9
4039
exec 9>&-
4140
echo "Released build cache lock before tests"
4241
fi

0 commit comments

Comments
 (0)