diff --git a/util/imagetools/create.go b/util/imagetools/create.go index fa168b1a..71853e07 100644 --- a/util/imagetools/create.go +++ b/util/imagetools/create.go @@ -80,12 +80,15 @@ func (r *Resolver) Combine(ctx context.Context, srcs []*Source, ann []string, pr // on single source, return original bytes if len(srcs) == 1 && len(ann) == 0 { switch srcs[0].Desc.MediaType { - case images.MediaTypeDockerSchema2Manifest: + // if the source is already an image index or manifest list, there is no need to consider the value + // of preferIndex since if set to true then the source is already in the preferred format, and if false + // it doesn't matter since we're not going to split it into separate manifests + case images.MediaTypeDockerSchema2ManifestList, ocispec.MediaTypeImageIndex: + return dts[0], srcs[0].Desc, nil + default: if !preferIndex { return dts[0], srcs[0].Desc, nil } - case images.MediaTypeDockerSchema2ManifestList, ocispec.MediaTypeImageIndex: - return dts[0], srcs[0].Desc, nil } }