Skip to content

Commit

Permalink
refactor: Update default build method to 'bazel'.
Browse files Browse the repository at this point in the history
  • Loading branch information
mattevans committed Dec 6, 2024
1 parent d0babdc commit 953cc3d
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 58 deletions.
2 changes: 1 addition & 1 deletion prysm/build_beacon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
35 changes: 16 additions & 19 deletions prysm/build_beacon_minimal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
35 changes: 16 additions & 19 deletions prysm/build_validator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
35 changes: 16 additions & 19 deletions prysm/build_validator_minimal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 953cc3d

Please sign in to comment.