Repository navigation
feat(ecr): serve tag manifests for listed repositories - #50
Merged
Merged
Conversation
Clients that pull by tag through an ECR pull-through cache, such as CI reusing a GHCR artifact by its input-key tag, get a 404 today because only digests are served. Add tag-repositories. For those repositories a tag manifest is fetched from ECR on every request and never cached, so Cachew adds no staleness beyond ECR's own pull-through re-sync. The manifest is read whole, checked against the requested manifest types, Content-Length and any reported digest, and answered with its computed digest and Cache-Control: no-store. Digest reads are unchanged. Co-authored-by: Perplexity <noreply@perplexity.ai>
Replace the package-level manifest type slice, which gochecknoglobals rejects, with constants and a switch. Cover a missing tag staying a 404, which clients use to detect a cache miss, and a tag repository outside repositories staying refused. Co-authored-by: Perplexity <noreply@perplexity.ai>
ravi-pplx
marked this pull request as ready for review
November 24, 2026 22:29
A tag-repositories entry outside a configured repositories list was accepted but could never serve, so reject it at config load. Cover the remaining tag refusals: an empty or oversized manifest and an ECR error status, each asserting its failure reason. Signed-off-by: Ravi Agarwal <ravi@perplexity.ai> Co-authored-by: Perplexity <noreply@perplexity.ai>
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.
Problem
Cachew's
ecrstrategy serves manifests and blobs by digest only. Clients that pull by tag through an ECR pull-through cache get a404. SPACE's kind CI is one such client: it reusesghcr.io/perplexityai/space-kind-rust-artifacts:<input key>by tag, so it can't go through Cachew and needs its own GHCR credentials.Change
Add
tag-repositoriestostrategy ecr. It takes the same entry forms asrepositories(an entry ending in/is a prefix), and whenrepositoriesis set, every entry must fall within it or the config is rejected. When it's empty, which is the default, no tags are served, so existing deployments behave the same.For a listed repository,
GET/HEAD /v2/<name>/manifests/<tag>:GETto ECR, including for a clientHEAD, so a first pull still imports through the pull-through rule. The result is never cached. ECR already keeps pull-through tags in sync with their upstream (at least every 24h), so Cachew adds no staleness of its own, and a moved tag is seen on the next request.Accept, aContent-Lengththat matches the body, and a matching sha256 when ECR reportsDocker-Content-Digest. Anything else is a502.Docker-Content-DigestandCache-Control: no-store. The client's following digest reads are cached as usual.404and429(withRetry-After) through, like digest reads.Tag reads are counted under
kind=tagincachew.ecr.requests_total.Deploy impact
None until a deployment sets
tag-repositories. Tag reads use the sameecr:BatchGetImage(andecr:BatchImportUpstreamImagefor first pulls) as digest manifest reads, so no IAM change is needed.Created with Perplexity