Use helm pull for downloading charts#197
Conversation
abrisco
left a comment
There was a problem hiding this comment.
Won't this just be slower as the Bazel repository cache won't be used?
|
|
|
Actually, we can return a Unfortunately, we can't determine the exact attributes required for reproducibility unless we parsed the output from YAML output which is returned via I filed helm/helm#31205 for having |
abrisco
left a comment
There was a problem hiding this comment.
helmis being cached and charts are only being downloaded if an attribute of the build rule changes. Rebuilding//tests/with_chart_depsdoesn't show the repository rule is always being executed.
That's not what I'm referring to. https://blog.engflow.com/2024/05/13/the-many-caches-of-bazel/#repository-cache
The rule won't run but any time it does Bazel will have to rely on whatever caching mechanism helm has to maybe skip downloading something or ensure the same thing from a previous point in time was downloaded. I've experienced massive issues with this in the earlier pip_parse rules from rules_python where developers would have volatile items in their pip cache that would make their way into builds and make everything slow. If pull is capable of fetching metadata, then I would be down for that but I ultimately want Bazel (via repository_ctx.download) to fetch and verify external dependencies.
|
What about maintaining two options? |
If there is something that's just not possible with just |
|
A couple benefits from using real
But even using For example, |
|
One more issue I thought of for OCI URLs: URLs that use a version digest ( Little demo of The SHA256 sum of the chart is not related to the OCI URL. |
If the invocation is reproducible, it will be cached: https://bazel.build/versions/8.4.0/rules/lib/builtins/repository_ctx?hl=en#repo_metadata
|
@abrisco, thoughts on #197 (comment)? Looking at https://github.com/bazel-contrib/rules_jvm_external and https://github.com/bazel-contrib/rules_python, they use |
Hey! Sorry for the radio silence here. Things have been hectic 😓 I'm extremely familiar with If there were to be a Though maybe this is something we could better discuss on slack at this point. I don't mean to be halting progress here. |
|
I don't have easy access to Slack, but email zachburg@google.com instead. |
|
A bit out of scope, but I wonder if this sort of case would support Bazel acting as an HTTP/HTTPS/etc. proxy? Tools like helm/mpm/npm/etc generally already need a way to redirect them to a proxy (e.g. to protect builds from supply chain attacks and to allow air-gaped builds) so a way to make their invocation proxy thought the existing bazel caching would offer an effective way to both integrate high fidelity caching as well as avoid re-implementing the native tool's logic in .bzl libraries. |
|
Using the bazel downloader is preferable in scenarios where users want to redirect through custom proxies and especially those that need credentials. https://blog.aspect.build/configuring-bazels-downloader gives a good overview and bazel's credential_helper support is already very nice for automatically injecting credentials instead of relying on |
|
I think it was rude of me to let this linger for as long as it has and I'm sorry for that. My feelings are that I'm against directly adding a mode that uses helm and doesn't use the bazel downloader since I've had many headaches from other tools that do similar things. But I do understand the convenience of it. Is there a path forward to ensuring there is a stable enough interface within these rules to allow these rules to live in a separate repo? I just don't have enough bandwidth or context to deal with any issues that come from invoking |
Since
helmis already available, use it for downloading charts usinghelm pullinstead of attempting to duplicatehelm.This will ensure any use cases handled by
helmcan be handled byrules_helm.Downloaded charts are cached in the workspace by Bazel since the repository rule isn't always re-executed (https://bazel.build/external/repo#when_is_the_implementation_function_executed)
A potential separate feature to add is pinning charts by their SHA-256 checksum, similar to https://github.com/bazel-contrib/rules_jvm_external?tab=readme-ov-file#pinning-artifacts-and-integration-with-bazels-downloader. But I think most Helm charts are small enough that I'm not concerned if the same chart has be downloaded in multiple workspaces instead of coming from the repository cache.