How to support Bazel module versioning #22303
Replies: 2 comments 8 replies
-
Some simple questions to begin with:
BTW this may be a time to separate the related concepts of "breaking" and "major". I think that if a module updated from 1.0.0 to 2.0.0 but said it's the same compatibility level, maybe we still call it a "major" update but breaking=false in metadata. Similarly in semver, you can have non-major 0.x updates which are breaking. |
Beta Was this translation helpful? Give feedback.
-
That is correct. The module author writes the
Yes. However, in the SemVer case, I would argue that the module maintainer has introduced a bug if they increment the major version in the version string and not increment the compatibility level.
Yes. |
Beta Was this translation helpful? Give feedback.
-
Type of discussion.
I just want to chat
Tell us more.
Background
Bazel module versions consist of two parts: the version string and the compatibility level. The version string uniquely identifies a release and is used to sort releases. The compatibility level is the "major version" number.
There is no requirement for the compatibility level to be represented in the version string. It is specified as a separate value with each module release. The following are some examples of Bazel module declarations that highlight the inability to extract the compatibility level directly from the version string.
To summarize, the version string uniquely identifies the release, but the complete information about the release version resides in the registry.
Issues Related to Supporting Bazel Module Versions in Renovate
Two primary issues need to be addressed to support Bazel module versions in Renovate.
How to Represent a Bazel Module Version
The Renovate APIs use a string value to represent a version. There is no canonical string representation for a Bazel module version (version string plus compatibility level). We could update the Renovate APIs to expect a customizable version struct. At first blush, that seems like a pretty big change. Unless there are other benefits to doing that kind of rework outside the scope of this discussion, it does not seem worthwhile.
The alternative is to design a string representation of a Bazel module version. The following are some options:
<version>|<compatibility_level>
1.0.0|0
,0.16.0|1
,20230125.3|5
{"version": "1.0.0", compatibility_level: 0}
v: "<version>", cl: <compatibility_level>
v: "1.0.0", cl: 0
How to Resolve a Version String to a Bazel Module Version
Let's look at this concerning the three primary APIs: Datasource, Versioning, and Manager.
bazel
Datasourcebazel-module
Versioningbazel-module
ManagerMODULE.bazel
files. Ex:bazel_dep(name = "rules_cc", version = "0.0.1")
The following are some options that I think are worth consideration.
Option 1: Manager Resolves the Versions
In this scenario, the manager would resolve each version string to a fully-qualified Bazel module version. This would require the manager to access the configured registries. This could be done by allowing the manager to leverage the existing datasources or via some custom mechanism. I think leveraging the existing datasources makes the most sense, as it could leverage any caching that may already be implemented.
Option 2: Manager Returns Version String Values, External Mechanism Resolves the Versions
In this scenario, the manager would not change. It would return the version strings extracted from the
MODULE.bazel
file. A separate mechanism would resolve the version strings to fully-qualified Bazel module versions. This separate mechanism would be activated via a manager configuration value. Ideally, this resolution mechanism would work with the results from configured datasources.Conclusion
Let me know what you think. I am curious to hear other ideas on how to tackle these issues.
Beta Was this translation helpful? Give feedback.
All reactions