Bazelisk

Practical Bazel: Use a Specific Version of Bazel
Practical Bazel bazel bazelisk
Published: 2020-10-27
Practical Bazel: Use a Specific Version of Bazel

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:

  1. Use Bazelisk and a .bazelversion file (recommended)
  2. 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.

Read more...