Bazel’s philosophy strongly encourages binding to exact, specific versions of all third-party dependencies to help ensure reproducible builds. As Bazel users, we must remember to extend this philosophy to Bazel itself.
When setting up a Bazel-based build system, you should choose a specific version of Bazel and require all developers and the build system to use it. This can be done in a few ways:
- Use Bazelisk and a
.bazelversion
file (recommended) - Installing a specific version of Bazel as part of your build and developer VM images / docker containers
With the first approach, upgrades to Bazel can then be treated like any other
upgrade: submit a pull request to the repo which updates the value in the
.bazelversion
file and runs the full continuous integration pipeline.