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>
| ... | ... |
@@ -346,10 +346,16 @@ func (p *v2Puller) pullV2Tag(ctx context.Context, ref reference.Named, platform |
| 346 | 346 |
} |
| 347 | 347 |
tagOrDigest = digested.Digest().String() |
| 348 | 348 |
} 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()) |
|
| 350 | 351 |
if err != nil {
|
| 351 | 352 |
return false, allowV1Fallback(err) |
| 352 | 353 |
} |
| 354 |
+ |
|
| 355 |
+ manifest, err = manSvc.Get(ctx, desc.Digest) |
|
| 356 |
+ if err != nil {
|
|
| 357 |
+ return false, err |
|
| 358 |
+ } |
|
| 353 | 359 |
tagOrDigest = tagged.Tag() |
| 354 | 360 |
} else {
|
| 355 | 361 |
return false, fmt.Errorf("internal error: reference has neither a tag nor a digest: %s", reference.FamiliarString(ref))
|