Repository navigation
Conversation
Part of git-pkgs#501. The tag list and referrers Link rewrite, manifest Accept negotiation and the references a manifest names move out of internal/handler into internal/metadata/oci, which takes its inputs explicitly and builds for wasip1. The handler keeps fetching, token auth, coalescing and caching, with its functions as thin wrappers.
|
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 27 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 OCI step.
As in #612 for npm, the OCI distribution metadata transformations move out of
internal/handlerintointernal/metadata/oci:RewriteLink, which points the targets of a tag list or referrersLinkheader that lead back into the upstream registry's API at the same endpoint on the proxy, keeping their query and thensroute the client is onAccepts,AcceptsIndex,Names,NormalizeAcceptandIsIndexMediaType, the manifest Accept negotiation, with the media type constants andDefaultManifestAcceptManifestRefs, which lists the digests an index or image manifest references, with theManifest,DescriptorandPlatformtypes andDigestPatternOCI has no cooldown or denylist filtering of tag lists, so this step is these pure parts only.
LinkOptionscarries the proxy and registry URLs, the request path and thensvalue explicitly. The package doesn't depend onhandler.Proxy. The code moves as it was, so responses and cache keys are the same.What stays in the handler: fetching, token auth, coalescing, caching and cache keys, the checks on cached manifests and upstream responses, path parsing, and the image tag and manifest records. The handler's functions stay as thin wrappers and the manifest types as aliases, so the handler tests run unchanged against the real routes.
Portability:
GOOS=wasip1 GOARCH=wasm go build ./internal/metadata/ociworks. The package imports only the standard library;imports_test.gofails on any non-standard import and onnet,net/http,log/slogordatabase/sql.New tests in
internal/metadata/ocicover the Link rewrite for relative, query-only and absolute targets, other hosts and schemes, paths outside/v2/, unparseable URLs, thensroute and several targets; Accept matching with wildcards, q values, parameters and specificity; normalisation; the index helpers; and manifest references, including duplicates, bad digests and the limit. They were mutation-checked, as was the handler's wiring. There are no benchmarks for these paths to compare.go test ./...andgolangci-lint run ./...pass.