Buf Schema Registry Custom Renovate Data source
At helpwave we love protobufs! Our services usually expose a gRPC API.
A fantastic tool which aids in protobuf development, and more importantly, maintenance, is the buf cli.
It does linting, breakage checks and streamlines code-generation for clients. For the latter, you can configure plugins in a buf.gen.yaml
file.
But as always, adding dependencies adds a maintenance burden. The BSR, the registry in which these plugins are managed, allows you do just pull the latest version of any given plugin. Do not give into the temptation and pin your dependencies!. This is especially important in the world of code-generation!
But now you have to deal with keeping those plugins up to date. A task simple enough to be automized. Tools like dependabot or renovate can do that for you.
Enough prelude, here is the changes to your renovate.json
you have to make to keep the BSR plugins up to date:
"customDatasources": {
+ "buf": {
+ "defaultRegistryUrlTemplate": "https://buf-resource-proxy.fly.dev/{{packageName}}",
+ "transformTemplates": ["{\"releases\":[{\"version\": resource.plugin.version }], \"sourceUrl\": resource.plugin.sourceUrl, \"homepage\": $join([\"https://buf.build/\", resource.plugin.owner, \"/\", resource.plugin.name])}"]
+ }
},
"customManagers": [
+ {
+ "customType": "regex",
+ "fileMatch": ["buf.gen.yaml$"],
+ "matchStrings": [
+ "plugin: buf.build/(?<depName>.*?):(?<currentValue>.+?)\\s"
+ ],
+ "datasourceTemplate": "custom.buf",
+ "versioningTemplate": "semver"
+ }
]
This will use a proxy we have hosted on fly, which we may take down at any time. So I highly recommend you to deploy it yourself (on fly), and then alter the "defaultRegistryUrlTemplate"
key in the renovate.json
.
The repo for it is available here: https://github.com/helpwave/buf-resource-proxy.