Repository navigation
Conversation
The Helm index rewrite, the chart lookup built from an index and their parsing move from internal/handler into internal/metadata/helm, which takes its inputs explicitly and doesn't depend on handler.Proxy. It builds for wasip1. The handler keeps fetching, caching, the refetch for downloads, the download cooldown check and mirroring, with its function names as thin wrappers. The rewrite checks cooldown with Evaluate at one EvaluatedAt, as the npm, PyPI and Composer packages do.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 37 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
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 #501, the Helm step.
As in #612 for npm, the Helm index transformations move out of
internal/handlerintointernal/metadata/helm:Rewrite: chart URLs pointing at the proxy, OCI references for configured registries pointing at the/v2routes, cooldown filtering, and leaving out releases that can't be read; it returns the releases kept aschart@digestBuildLookupandLookup, the HTTP downloads an index lists by digest and each release's first download by chart and version, withListsChartProxyURLandOCIProxyReferenceParseIndex,IndexEntries,MappingValueandNormalizeDigestThe package takes its inputs explicitly in
Options: proxy URL, repository name and upstream URL, OCI registries, the cooldown policy and the time cooldown is evaluated at. It reports releases it leaves out as malformed throughOnMalformed, which the handler logs as before. It doesn't depend onhandler.Proxy. It has a small copy of the handler's..-segment check for OCI references, since that lives ininternal/handler.What stays in the handler: fetching, the rewrite cache, the per-repository lookup cache, the refetch for a download the index doesn't list (#800), the download and mirror cooldown checks, and mirroring. The handler's function names stay as thin wrappers, and
helmChartLookup,helmReleaseandhelmOCIRegistryare aliases of the package types, so the handler tests run unchanged against the real routes.Cooldown in the rewrite is checked with
Evaluateat oneEvaluatedAtinstead ofIsAllowedper release, as ininternal/metadata/npm. The handler passestime.Now(), so results are the same unless a rewrite runs across a cooldown boundary. Downloads keepIsAllowed.Portability:
GOOS=wasip1 GOARCH=wasm go build ./internal/metadata/helmworks.imports_test.gofails on any non-standard import outside an allowlist (cooldown, purl, vers, packageurl-go,internal/packageurl, andgopkg.in/yaml.v3for the index) and onnet,net/http,log/slogordatabase/sql.Benchmarks (
BenchmarkHelmIndexRequest, main vs this branch, test binaries run alternately, n=8) show no difference beyond run-to-run noise; the machine was busy, so single runs varied a lot.New tests in
internal/metadata/helmcover the URL and OCI rewrites, cooldown evaluated atEvaluatedAt, a disabled and a missing policy, malformed releases and indexes, the lookup (first release per version, OCI releases,Lists), the OCI reference rules and digest normalisation. They were mutation-checked, as was the handler's wiring.go test ./...andgolangci-lint run ./...pass.