Skip to content

Commit 5bfabf1

Browse files
authored
fix(build_beacon.sh): add fallback logic when remote cache fails (#292)
Retry build without remote cache on first failure, then clean local cache and retry once more to handle transient cache corruption issues.
1 parent e4f2a5f commit 5bfabf1

File tree

4 files changed

+44
-4
lines changed

4 files changed

+44
-4
lines changed

prysm/build_beacon.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,17 @@ END
3838
;;
3939
"bazel")
4040
echo "Building with Bazel..."
41-
$HOME/go/bin/bazelisk build //cmd/beacon-chain:beacon-chain --config=release --define pgo_enabled=0 --enable_bzlmod=false --remote_cache=grpcs://bazel-remote-cache-grpc.primary.production.platform.ethpandaops.io:443
41+
# Try with remote cache first
42+
if ! $HOME/go/bin/bazelisk build //cmd/beacon-chain:beacon-chain --config=release --define pgo_enabled=0 --enable_bzlmod=false --remote_cache=grpcs://bazel-remote-cache-grpc.primary.production.platform.ethpandaops.io:443; then
43+
echo "Build failed with remote cache, trying without remote cache..."
44+
# Try without remote cache to avoid cache corruption issues
45+
if ! $HOME/go/bin/bazelisk build //cmd/beacon-chain:beacon-chain --config=release --define pgo_enabled=0 --enable_bzlmod=false; then
46+
echo "Build still failing, cleaning local Bazel cache and retrying..."
47+
# Clean the local Bazel cache and try once more
48+
$HOME/go/bin/bazelisk clean --expunge
49+
$HOME/go/bin/bazelisk build //cmd/beacon-chain:beacon-chain --config=release --define pgo_enabled=0 --enable_bzlmod=false
50+
fi
51+
fi
4252
mv bazel-bin/cmd/beacon-chain/beacon-chain_/beacon-chain _beacon-chain
4353
;;
4454
*)

prysm/build_beacon_minimal.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,17 @@ END
3838
;;
3939
"bazel")
4040
echo "Building with Bazel..."
41-
$HOME/go/bin/bazelisk build //cmd/beacon-chain:beacon-chain --config=minimal --define pgo_enabled=0 --enable_bzlmod=false --remote_cache=grpcs://bazel-remote-cache-grpc.primary.production.platform.ethpandaops.io:443
41+
# Try with remote cache first
42+
if ! $HOME/go/bin/bazelisk build //cmd/beacon-chain:beacon-chain --config=minimal --define pgo_enabled=0 --enable_bzlmod=false --remote_cache=grpcs://bazel-remote-cache-grpc.primary.production.platform.ethpandaops.io:443; then
43+
echo "Build failed with remote cache, trying without remote cache..."
44+
# Try without remote cache to avoid cache corruption issues
45+
if ! $HOME/go/bin/bazelisk build //cmd/beacon-chain:beacon-chain --config=minimal --define pgo_enabled=0 --enable_bzlmod=false; then
46+
echo "Build still failing, cleaning local Bazel cache and retrying..."
47+
# Clean the local Bazel cache and try once more
48+
$HOME/go/bin/bazelisk clean --expunge
49+
$HOME/go/bin/bazelisk build //cmd/beacon-chain:beacon-chain --config=minimal --define pgo_enabled=0 --enable_bzlmod=false
50+
fi
51+
fi
4252
mv bazel-bin/cmd/beacon-chain/beacon-chain_/beacon-chain _beacon-chain
4353
;;
4454
*)

prysm/build_validator.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,17 @@ END
3838
;;
3939
"bazel")
4040
echo "Building with Bazel..."
41-
$HOME/go/bin/bazelisk build //cmd/validator:validator --config=release --define pgo_enabled=0 --enable_bzlmod=false --remote_cache=grpcs://bazel-remote-cache-grpc.primary.production.platform.ethpandaops.io:443
41+
# Try with remote cache first
42+
if ! $HOME/go/bin/bazelisk build //cmd/validator:validator --config=release --define pgo_enabled=0 --enable_bzlmod=false --remote_cache=grpcs://bazel-remote-cache-grpc.primary.production.platform.ethpandaops.io:443; then
43+
echo "Build failed with remote cache, trying without remote cache..."
44+
# Try without remote cache to avoid cache corruption issues
45+
if ! $HOME/go/bin/bazelisk build //cmd/validator:validator --config=release --define pgo_enabled=0 --enable_bzlmod=false; then
46+
echo "Build still failing, cleaning local Bazel cache and retrying..."
47+
# Clean the local Bazel cache and try once more
48+
$HOME/go/bin/bazelisk clean --expunge
49+
$HOME/go/bin/bazelisk build //cmd/validator:validator --config=release --define pgo_enabled=0 --enable_bzlmod=false
50+
fi
51+
fi
4252
mv bazel-bin/cmd/validator/validator_/validator _validator
4353
;;
4454
*)

prysm/build_validator_minimal.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,17 @@ END
3838
;;
3939
"bazel")
4040
echo "Building with Bazel..."
41-
$HOME/go/bin/bazelisk build //cmd/validator:validator --config=minimal --define pgo_enabled=0 --enable_bzlmod=false --remote_cache=grpcs://bazel-remote-cache-grpc.primary.production.platform.ethpandaops.io:443
41+
# Try with remote cache first
42+
if ! $HOME/go/bin/bazelisk build //cmd/validator:validator --config=minimal --define pgo_enabled=0 --enable_bzlmod=false --remote_cache=grpcs://bazel-remote-cache-grpc.primary.production.platform.ethpandaops.io:443; then
43+
echo "Build failed with remote cache, trying without remote cache..."
44+
# Try without remote cache to avoid cache corruption issues
45+
if ! $HOME/go/bin/bazelisk build //cmd/validator:validator --config=minimal --define pgo_enabled=0 --enable_bzlmod=false; then
46+
echo "Build still failing, cleaning local Bazel cache and retrying..."
47+
# Clean the local Bazel cache and try once more
48+
$HOME/go/bin/bazelisk clean --expunge
49+
$HOME/go/bin/bazelisk build //cmd/validator:validator --config=minimal --define pgo_enabled=0 --enable_bzlmod=false
50+
fi
51+
fi
4252
mv bazel-bin/cmd/validator/validator_/validator _validator
4353
;;
4454
*)

0 commit comments

Comments
 (0)