Test and record Bazel compatibility for BCR modules #1332
Replies: 4 comments 1 reply
-
/cc @Wyverald @fmeum @rickeylev @keith @alexeagle @comius @hobofan |
Beta Was this translation helpful? Give feedback.
-
Considering minor releases are backwards compatible so users can always upgrade to the latest version effortlessly, I find recording the minimal compatible version of a LTS release might not be necessary. Therefore, alternatively, we can just record a true or false value which indicates whether the latest version of the LTS release is compatible with the module version.
This should make it much easier to update In presubmit, we'll just test the module version with the latest versions of all supported LTS releases. |
Beta Was this translation helpful? Give feedback.
-
After some discussion in the rules authors meeting, we decided to just simplify this to specifying |
Beta Was this translation helpful? Give feedback.
-
Done in #1387 |
Beta Was this translation helpful? Give feedback.
-
Goals
Since the release of Bazel 7, we now have two Bazel LTS releases that officially support Bzlmod. As the community migrates to Bzlmod, it'll be beneficial to test BCR modules against all supported Bazel LTS releases and document their compatibility.
This will enable:
Solutions
1. In the
metadata.json
of the moduleThe original proposal in this doc is to document the compatibility info in the metadata.json file of each module.
For example, in
modules/rules_apple/bazel_compatibility.json
:But this approach has some disadvantages:
2. In a per-version
bazel_compatibility.json
fileInstead of solution 1, we can document the compatibility info in a per-version bazel_compatibility.json file.
For example, in
modules/rules_apple/3.1.0/bazel_compatibility.json
:In this JSON file, each key represents the major version number of a Bazel LTS release, and its corresponding value indicates the minimum version within that LTS release that is compatible with the current module version.
null
means none of the versions of that LTS release is compatible.Differences from the
bazel_compatibility
attributeWith the
bazel_compatibility
attribute of themodule
directive in MODULE.bazel, module authors can already specify Bazel compatibility info. So why do we need a separatebazel_compatibility.json
file?There are two key differences:
bazel_compatibility
attribute is a general Bzlmod feature that works not only for BCR, but also for other Bazel registries and overridden modules.Therefore, one cannot replace the other.
BCR presubmit changes
BCR presubmit will be updated to check Bazel compatibility:
modules/<module name>/<version>/
for the tested module. If not, assuming all Bazel LTS versions are compatible by defaulting to"X": "X.0.0"
for each LTS release.presubmit.yml
with the above Bazel versions.If anything breaks, the PR author can create/update the bazel_compatibility.json file to allow the presubmit to pass by bumping the minimal version or changing it to null.
Question: should we always test the latest LTS release? For example, even if
"7": "7.0.0"
was recorded, should we still test 7.1.0?Update modules retrospectively
During the ramp up phase or when a new Bazel LTS release is out, we need to update existing modules retrospectively.
To do that, create/update the bazel_compatibility.json files for existing module versions with a PR. After the BCR presubmit update, the PR should trigger builds for all modified versions. If anything breaks, we update the bazel_compatibility.json files to reflect the actual compatibility.
It might be worth implementing a new pipeline to bisect the minimal version of a LTS release that is compatible for a given module version.
BCR UI changes
https://registry.bazel.build should be updated to include Bazel compatibility info. The UI should make it easy to lookup 1) Given a module version, which Bazel LTS releases are compatible. 2) Given a Bazel version, which module versions are compatible
Limitations
Even with the above process, the recorded Bazel compatibility may not be accurate as it depends on what tests are specified in the presubmit.yml for each module.
Beta Was this translation helpful? Give feedback.
All reactions