Skip to content

feat(ecr): serve tag manifests for listed repositories - #50

Merged
ravi-pplx merged 3 commits into
pplx/mainfrom
ravi/ecr-tag-manifests
Nov 24, 2026
Merged

ravi-pplx merged 3 commits into
pplx/mainfrom
ravi/ecr-tag-manifests

Conversation

@ravi-pplx

@ravi-pplx ravi-pplx commented Nov 24, 2026 •

Copy link
Copy Markdown

Problem

Cachew's ecr strategy serves manifests and blobs by digest only. Clients that pull by tag through an ECR pull-through cache get a 404. SPACE's kind CI is one such client: it reuses ghcr.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-repositories to strategy ecr. It takes the same entry forms as repositories (an entry ending in / is a prefix), and when repositories is 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>:

  • Always sends a GET to ECR, including for a client HEAD, 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.
  • Reads the manifest whole, up to 4 MiB. It requires one of the manifest types Cachew sends in Accept, a Content-Length that matches the body, and a matching sha256 when ECR reports Docker-Content-Digest. Anything else is a 502.
  • Answers with the computed Docker-Content-Digest and Cache-Control: no-store. The client's following digest reads are cached as usual.
  • Passes 404 and 429 (with Retry-After) through, like digest reads.

Tag reads are counted under kind=tag in cachew.ecr.requests_total.

Deploy impact

None until a deployment sets tag-repositories. Tag reads use the same ecr:BatchGetImage (and ecr:BatchImportUpstreamImage for first pulls) as digest manifest reads, so no IAM change is needed.

Created with Perplexity

ravi-pplx and others added 2 commits November 24, 2026 20:33
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
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>
@ravi-pplx
ravi-pplx merged commit 51ac13a into pplx/main Nov 24, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant