Merge pull request #2684 from dmcgowan/manifest-resolution

Update manifest resolution for non-index manifests
This commit is contained in:
Michael Crosby 2018-09-27 10:24:47 -04:00 committed by GitHub
commit 75d7d6e7a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -129,6 +129,13 @@ type platformManifest struct {
// Manifest resolves a manifest from the image for the given platform. // 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 // TODO(stevvooe): This violates the current platform agnostic approach to this
// package by returning a specific manifest type. We'll need to refactor 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 // 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 return nil, err
} }
if platform != nil { if desc.Digest != image.Digest && platform != nil {
if desc.Platform != nil && !platform.Match(*desc.Platform) { if desc.Platform != nil && !platform.Match(*desc.Platform) {
return nil, nil return nil, nil
} }