diff --git a/prysm/build_beacon.sh b/prysm/build_beacon.sh index 4b78a6f..8305a9d 100755 --- a/prysm/build_beacon.sh +++ b/prysm/build_beacon.sh @@ -13,7 +13,7 @@ else go install github.com/bazelbuild/bazelisk@latest fi -build_method=${build_method:-go} # Default to go if not set +build_method=${build_method:-bazel} # Default to bazel if not set case ${build_method} in "go") diff --git a/prysm/build_beacon_minimal.sh b/prysm/build_beacon_minimal.sh index 3a73d22..9c378a6 100755 --- a/prysm/build_beacon_minimal.sh +++ b/prysm/build_beacon_minimal.sh @@ -13,27 +13,24 @@ else go install github.com/bazelbuild/bazelisk@latest fi -build_with_go() { - echo "Building with Go..." - go mod tidy - CGO_ENABLED=1 go build -tags="minimal" -o _beacon-chain ./cmd/beacon-chain -} +build_method=${build_method:-bazel} # Default to bazel if not set -build_with_bazel() { - echo "Building with Bazel..." - $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 - if [ $? -eq 0 ]; then - # move to base dir to avoid any dockerignore/stat issues +case ${build_method} in + "go") + echo "Building with Go..." + go mod tidy + CGO_ENABLED=1 go build -tags="minimal,blst_enabled,blst_portable" -o _beacon-chain ./cmd/beacon-chain + ;; + "bazel") + echo "Building with Bazel..." + $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 mv bazel-bin/cmd/beacon-chain/beacon-chain_/beacon-chain _beacon-chain - return 0 - else - echo "Bazel build failed, falling back to go build..." - return 1 - fi -} - -# Try Bazel first, fall back to Go if it fails. -build_with_bazel || build_with_go + ;; + *) + echo "Invalid build_method value: ${build_method}. Must be 'go' or 'bazel'" + exit 1 + ;; +esac cp ${SCRIPT_DIR}/entrypoint.sh entrypoint.sh diff --git a/prysm/build_validator.sh b/prysm/build_validator.sh index d319f72..74172b0 100755 --- a/prysm/build_validator.sh +++ b/prysm/build_validator.sh @@ -13,27 +13,24 @@ else go install github.com/bazelbuild/bazelisk@latest fi -build_with_go() { - echo "Building with Go..." - go mod tidy - CGO_ENABLED=1 go build -o _validator ./cmd/validator -} +build_method=${build_method:-bazel} # Default to bazel if not set -build_with_bazel() { - echo "Building with Bazel..." - $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 - if [ $? -eq 0 ]; then - # move to base dir to avoid any dockerignore/stat issues +case ${build_method} in + "go") + echo "Building with Go..." + go mod tidy + CGO_ENABLED=1 go build -tags=blst_enabled,blst_portable -o _validator ./cmd/validator + ;; + "bazel") + echo "Building with Bazel..." + $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 mv bazel-bin/cmd/validator/validator_/validator _validator - return 0 - else - echo "Bazel build failed, falling back to go build..." - return 1 - fi -} - -# Try Bazel first, fall back to Go if it fails. -build_with_bazel || build_with_go + ;; + *) + echo "Invalid build_method value: ${build_method}. Must be 'go' or 'bazel'" + exit 1 + ;; +esac cp ${SCRIPT_DIR}/entrypoint.sh entrypoint.sh diff --git a/prysm/build_validator_minimal.sh b/prysm/build_validator_minimal.sh index 77b6f12..a241aef 100755 --- a/prysm/build_validator_minimal.sh +++ b/prysm/build_validator_minimal.sh @@ -13,27 +13,24 @@ else go install github.com/bazelbuild/bazelisk@latest fi -build_with_go() { - echo "Building with Go..." - go mod tidy - CGO_ENABLED=1 go build -tags="minimal" -o _validator ./cmd/validator -} +build_method=${build_method:-bazel} # Default to bazel if not set -build_with_bazel() { - echo "Building with Bazel..." - $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 - if [ $? -eq 0 ]; then - # move to base dir to avoid any dockerignore/stat issues +case ${build_method} in + "go") + echo "Building with Go..." + go mod tidy + CGO_ENABLED=1 go build -tags="minimal,blst_enabled,blst_portable" -o _validator ./cmd/validator + ;; + "bazel") + echo "Building with Bazel..." + $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 mv bazel-bin/cmd/validator/validator_/validator _validator - return 0 - else - echo "Bazel build failed, falling back to go build..." - return 1 - fi -} - -# Try Bazel first, fall back to Go if it fails. -build_with_bazel || build_with_go + ;; + *) + echo "Invalid build_method value: ${build_method}. Must be 'go' or 'bazel'" + exit 1 + ;; +esac cp ${SCRIPT_DIR}/entrypoint.sh entrypoint.sh