From b697ec3c835f593de8742ccd19a55314a522e228 Mon Sep 17 00:00:00 2001 From: Anton Sankov Date: Tue, 27 Aug 2024 11:47:18 +0300 Subject: [PATCH] Populate image index for `remoteImage` --- image/remote.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/image/remote.go b/image/remote.go index dc44c0c..c1d1531 100644 --- a/image/remote.go +++ b/image/remote.go @@ -86,10 +86,16 @@ func tryRemote(ctx context.Context, imageName string, ref name.Reference, option return nil, err } + index, err := desc.ImageIndex() + if err != nil { + return nil, err + } + // Return v1.Image if the image is found in Docker Registry return remoteImage{ name: imageName, Image: img, + imageIndex: index, ref: implicitReference{ref: ref}, descriptor: desc, }, nil @@ -99,7 +105,9 @@ type remoteImage struct { name string ref implicitReference descriptor *remote.Descriptor + v1.Image + imageIndex v1.ImageIndex } func (img remoteImage) Name() string { @@ -128,7 +136,7 @@ func (img remoteImage) RepoDigests() []string { } func (img remoteImage) Index() *v1.IndexManifest { - return nil + return img.Index() } type implicitReference struct {