inspect: add API-version gate for image identity
| ... | ... |
@@ -92,9 +92,13 @@ func (i *ImageService) ImageInspect(ctx context.Context, refOrID string, opts im |
| 92 | 92 |
target = multi.Best.Target() |
| 93 | 93 |
} |
| 94 | 94 |
|
| 95 |
- identity, err := i.imageIdentity(ctx, c8dImg.Target, multi) |
|
| 96 |
- if err != nil {
|
|
| 97 |
- log.G(ctx).WithError(err).Warn("failed to determine Identity property")
|
|
| 95 |
+ var identity *imagetypes.Identity |
|
| 96 |
+ if opts.Identity {
|
|
| 97 |
+ var err error |
|
| 98 |
+ identity, err = i.imageIdentity(ctx, c8dImg.Target, multi) |
|
| 99 |
+ if err != nil {
|
|
| 100 |
+ log.G(ctx).WithError(err).Warn("failed to determine Identity property")
|
|
| 101 |
+ } |
|
| 98 | 102 |
} |
| 99 | 103 |
|
| 100 | 104 |
resp := &imagebackend.InspectData{
|
| ... | ... |
@@ -381,6 +381,7 @@ func (ir *imageRouter) getImagesByName(ctx context.Context, w http.ResponseWrite |
| 381 | 381 |
|
| 382 | 382 |
inspectData, err := ir.backend.ImageInspect(ctx, vars["name"], imagebackend.ImageInspectOpts{
|
| 383 | 383 |
Manifests: manifests, |
| 384 |
+ Identity: versions.GreaterThanOrEqualTo(httputils.VersionFromContext(ctx), "1.53"), |
|
| 384 | 385 |
Platform: platform, |
| 385 | 386 |
}) |
| 386 | 387 |
if err != nil {
|