Repository navigation
Mirror Helm charts - #606
Merged
Merged
Conversation
Mirroring pkg:helm PURLs failed with an unsupported ecosystem error. The
namespace now names the upstream.helm repository, as the Helm handler
caches charts per repository: pkg:helm/{repository}/{chart}@{version}.
The chart is found in the repository's index through the handler's own
index lookup, fetched from the first URL the release lists, as helm does,
checked against the listed digest and cached under the repository,
digest and filename the handler serves it from. The index goes through
the metadata cache, so helm finds the chart there while the repository is
down. Unversioned PURLs list every version in the index.
Charts without a repository, from an unconfigured one, or listed in an
OCI registry are refused; the last are pulled through /v2, and the error
names the pkg:oci PURL that mirrors them.
4 of 11 tasks
andrew
approved these changes
Oct 26, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #414.
Mirroring
pkg:helm/...failed withunsupported ecosystem. The Helm handler caches charts per configured repository, not per chart name, so the PURL namespace names theupstream.helmrepository:pkg:helm/{repository}/{chart}@{version}. The purl spec defines no repository qualifier for helm (the purl library dropsrepository_urlfor it on purpose), so the namespace is the only place for it.A release is mirrored the way
handleChartwould fetch it:index.yamlthrough the handler's own index lookup (chartLookup, now also keyed by chart and version), read through the metadata cache under the handler's key;GetOrFetchArtifactFromURLWithDigest, and cached ashelm/ repository / digest / filename, the keyhandleChartreads.Since the index is cached too,
helm repo addandhelm pullwork against the proxy with the repository down (withcache_metadataon, whichproxy mirroralways sets). Unversioned PURLs list every version in the index through the registries Helm client, pointed at the configured repository URL.Refused, with a message saying why:
upstream.helm(the message lists the configured ones);/v2, so the error names thepkg:ociPURL that mirrors them as an image;The mirror builds its own
HelmHandler(Mirror.Charts), set byproxy mirrorand the mirror API. To keeprunMirrorunder the lint's maintainability limit, building the command's mirror moved intonewCommandMirror. The shared test helper now setsCacheMetadataand passes its version lister to the PURL source, asproxy mirrordoes.Tested through the mirror and then the Helm handler with the upstream closed: the index and the chart come from the cache (
internal/server/mirror_helm_test.go), a digest mismatch is refused and leaves nothing to serve, and the refusals above. The tests fail without the change. Against https://charts.jetstack.io I mirroredpkg:helm/jetstack/cert-manager@v1.21.3, ran the proxy withHTTPS_PROXYpointing at a dead port, andhelm pull jetstack/cert-manager --version v1.21.3(alpine/helm 3.16.4) got the chart with the published digest; v1.21.2, not mirrored, failed with 502.