From ef8498bf79f61ea7ad296c356f88515805d4efb7 Mon Sep 17 00:00:00 2001 From: Derek McGowan Date: Tue, 25 Sep 2018 17:50:06 -0700 Subject: [PATCH] Update manifest resolution for non-index manifests Avoid filtering manifests by platform when a non-index manifest is provided to the Manifest function. Signed-off-by: Derek McGowan --- images/image.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/images/image.go b/images/image.go index 4d6979d7a..f72684d82 100644 --- a/images/image.go +++ b/images/image.go @@ -129,6 +129,13 @@ type platformManifest struct { // Manifest resolves a manifest from the image for the given platform. // +// When a manifest descriptor inside of a manifest index does not have +// a platform defined, the platform from the image config is considered. +// +// If the descriptor points to a non-index manifest, then the manifest is +// unmarshalled and returned without considering the platform inside of the +// config. +// // TODO(stevvooe): This violates the current platform agnostic approach to this // package by returning a specific manifest type. We'll need to refactor this // to return a manifest descriptor or decide that we want to bring the API in @@ -152,7 +159,7 @@ func Manifest(ctx context.Context, provider content.Provider, image ocispec.Desc return nil, err } - if platform != nil { + if desc.Digest != image.Digest && platform != nil { if desc.Platform != nil && !platform.Match(*desc.Platform) { return nil, nil }