blob: ef6c732115d14ce712bedf6d573e4e9220c43167 [file] [log] [blame] [view]
Dmitry Lomov4285b4b2019-07-30 15:10:38 -07001---
2layout: documentation
3title: Updating Bazel
daroberts223aebd2021-02-18 17:53:30 -08004category: getting-started
Dmitry Lomov4285b4b2019-07-30 15:10:38 -07005---
6
7# Updating Bazel
8
Googler630941e2020-12-23 17:13:31 -08009This page covers how to automatically update your Bazel version using Bazelisk.
10
daroberts917e1192020-06-08 16:36:50 -070011The Bazel project has a [backward compatibility
aiuto4e9a77e2021-06-15 08:55:11 -070012policy](https://docs.bazel.build/versions/main/backward-compatibility.html)
Greg Estrene821cfa2020-02-20 09:34:56 -080013(see [guidance for rolling out incompatible
Googler630941e2020-12-23 17:13:31 -080014changes](https://www.bazel.build/maintaining/breaking-changes-guide.html) if you
15are the author of one). That page summarizes best practices on how to test and
16migrate your project with upcoming incompatible changes and how to provide
17feedback to the incompatible change authors.
Dmitry Lomov4285b4b2019-07-30 15:10:38 -070018
Greg Estrene821cfa2020-02-20 09:34:56 -080019## Managing Bazel versions with Bazelisk
20
ranjanih45384812021-04-14 09:23:43 -070021[Bazelisk](https://github.com/bazelbuild/bazelisk) helps you manage Bazel
Greg Estrene821cfa2020-02-20 09:34:56 -080022versions.
23
24Bazelisk can:
ranjanih45384812021-04-14 09:23:43 -070025* Auto-update Bazel to the latest LTS or rolling release.
Greg Estrene821cfa2020-02-20 09:34:56 -080026* Build the project with a Bazel version specified in the .bazelversion
27 file. Check in that file into your version control to ensure reproducibility
28 of your builds.
29* Help migrate your project for incompatible changes (see above)
30* Easily try release candidates
Dmitry Lomov4285b4b2019-07-30 15:10:38 -070031
32## Recommended migration process
33
ranjanih45384812021-04-14 09:23:43 -070034Within minor updates to any LTS release, any
35project can be prepared for the next release without breaking
36compatibility with the current release. However, there may be
37backward-incompatible changes between major LTS versions.
Dmitry Lomov4285b4b2019-07-30 15:10:38 -070038
ranjanih45384812021-04-14 09:23:43 -070039Follow this process to migrate from one major version to another:
Dmitry Lomov4285b4b2019-07-30 15:10:38 -070040
ranjanih45384812021-04-14 09:23:43 -0700411. Read the release notes to get advice on how to migrate to the next version.
421. Major incompatible changes should have an associated `--incompatible_*` flag
43 and a corresponding GitHub issue:
Dmitry Lomov4285b4b2019-07-30 15:10:38 -070044 * Migration guidance is available in the associated GitHub issue.
ranjanih45384812021-04-14 09:23:43 -070045 * Tooling is available for some of incompatible changes migration. For
46 example, [buildifier](https://github.com/bazelbuild/buildtools/releases).
47 * Report migration problems by commenting on the associated GitHub issue.
Dmitry Lomov4285b4b2019-07-30 15:10:38 -070048
ranjanih45384812021-04-14 09:23:43 -070049After migration, you can continue to build your projects without worrying about
50backward-compatibility until the next major release.