Bazelregistry
| source | condition | target |
|---|---|---|
✔ | ✔ | ✗ |
Description
The bazelregistry resource reads a module’s metadata.json from a Bazel registry (the Bazel Central Registry by default) and returns a published version.
- source
Returns the version matching
versionfilter.- condition
Checks that the version exists in the registry.
- target
Not supported - a target fails with
target not supported for the plugin bazelregistry. To write the version into aMODULE.bazel, usebazelmod.
Note | An scm attached to a condition is ignored, with a warning (the lookup is always remote). |
Parameters
| Name | Type | Description | Required |
|---|---|---|---|
| module | string | “module” defines the name of the Bazel module to query from the registry. compatible:
remark:
example:
| |
| url | string | “url” defines a custom registry URL. compatible:
default: https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/{module}/metadata.json remark:
example:
| |
| versionfilter | object | “versionfilter” defines the version pattern and its kind, such as regex, semver or latest. compatible:
default: kind: latest remark:
| |
| kind | string | “kind” defines the versioning scheme used to select a version. default: latest remark:
example:
| |
| pattern | string | “pattern” defines the version pattern, according to “kind”. default:
remark:
example:
| |
| regex | string | “regex” defines the regular expression extracting the version from each entry. remark:
example:
| |
| replaceall | object | “replaceall” applies a regular expression replacement to each version before filtering. remark:
example: turns “curl-8_15_0” into “curl-8.15.0”. | |
| strict | boolean | “strict” enforces strict semantic versioning rules when parsing versions. default: false remark:
|
module is mandatory; omitting it aborts the run with wrong spec content, preceded by bazelregistry module undefined.
versionfilterDefaults to
kind: latest. See the "Version Filtering" page.
Custom registries
url points at a private registry. It is a template, not a base URL, it must contain the {module} placeholder, which is replaced with the module name:
spec:
module: rules_python
url: https://mycompany.example.com/bazel-registry/modules/{module}/metadata.jsonThe default is the Bazel Central Registry:
https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/{module}/metadata.jsonExample
sources:
rules_python:
name: Get latest version of Bazel module rules_python
kind: bazelregistry
spec:
module: rules_python
versionfilter:
kind: semver
pattern: '>=0.25.0'