Skip to content

Commit e4cf1c7

Browse files
committed
pull: use tag service for pulling tagged reference
The tag service does a `HEAD` request to get the manifest digest, where we can then do a `GET` against the digest. The `GET` by tag is not cacheable, but the `GET` against the digest is. This allows proxies to work way better. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
1 parent bb23f1b commit e4cf1c7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

distribution/pull_v2.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,10 +346,16 @@ func (p *v2Puller) pullV2Tag(ctx context.Context, ref reference.Named, platform
346346
}
347347
tagOrDigest = digested.Digest().String()
348348
} else if tagged, isTagged := ref.(reference.NamedTagged); isTagged {
349-
manifest, err = manSvc.Get(ctx, "", distribution.WithTag(tagged.Tag()))
349+
tagService := p.repo.Tags(ctx)
350+
desc, err := tagService.Get(ctx, tagged.Tag())
350351
if err != nil {
351352
return false, allowV1Fallback(err)
352353
}
354+
355+
manifest, err = manSvc.Get(ctx, desc.Digest)
356+
if err != nil {
357+
return false, err
358+
}
353359
tagOrDigest = tagged.Tag()
354360
} else {
355361
return false, fmt.Errorf("internal error: reference has neither a tag nor a digest: %s", reference.FamiliarString(ref))

0 commit comments

Comments
 (0)