build: Simplify bazel command lines#1909
Merged
Merged
Conversation
Move variables and options to .bazelrc files to simplify Bazel command lines. This makes local builds easier and allows for the explicit platform setting to be removed from local builds so that Bazel chooses the appropriate toolchain. For example, instead of: CARGO_BAZEL_REPIN=true bazel test --platforms=//bazel:linux_aarch64 --config=release --extra_toolchains=//bazel/toolchains:all --repo_env=BAZEL_LLVM_PATH=/usr/lib/llvm-18 //tests/... this can be used: bazel test --config=release //tests/... Change clang install to check the installed version and not issuing apt install if not needed. This gets around current upstream clang apt repo breakage with package version requirements. Signed-off-by: Jarno Rajahalme <jarno@isovalent.com>
0b659df to
8237562
Compare
Avoid bazel cargo repin on every bazel invocation, as it fetches dependencies and adds ~15 seconds to each bazel invocation. Instead, bring the Cargo.Bazel.lock file into bazel/ and update it only whne needed. This is needed due to difference in bazel target names in upstream Envoy repo vs. Envoy as a depndency being hashed in to the lock file, so the upstream hash never matches. Add a new make target "cargo-repin" to update the checked in lock file. This needs to be done if bazel ever complains about hash not matching, e.g., when upstream rust dependencies change. Avoid performing bazel query for TIDY_SOURCES on each make invocation by removing it from compile_commands.json dependencies. This only affects local builds, as compile_commands.json is not part of the repo (it is in .gitignore) so that fresh builds (e.g., in CI) always create this file on-demand. New dependencies make it very likely that it is refreshed when needed even locally. Signed-off-by: Jarno Rajahalme <jarno@isovalent.com>
mv or install do not work properly with file system mounted from the host to a VM, at least on a Lima VM there are permissions errors. Replace mv with combo of rm/cp/chmod to resolve this. Signed-off-by: Jarno Rajahalme <jarno@isovalent.com>
sayboras
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Move variables and options to
.bazelrcfiles to simplify Bazel command lines. This makes local builds easier and allows for the explicit platform setting to be removed from local builds so that Bazel chooses the appropriate toolchain. For example, instead of:this can be used:
Change clang install to check the installed version and not issuing apt install if not needed. This gets around current upstream clang apt repo breakage with package version requirements.
Note that since
--platformsoption changed Bazel will build from scratch (once).Remove the repeated bazel cargo repin by bringing the lock file into this repo and adding a new make target
cargo-repinto update it when needed. This removes about 15 seconds from each bazel invocation.Fix local build installation.