Skip to content

Commit 75d7d6e

Browse files
Merge pull request #2684 from dmcgowan/manifest-resolution
Update manifest resolution for non-index manifests
2 parents f88d3e5 + ef8498b commit 75d7d6e

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

images/image.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,13 @@ type platformManifest struct {
129129

130130
// Manifest resolves a manifest from the image for the given platform.
131131
//
132+
// When a manifest descriptor inside of a manifest index does not have
133+
// a platform defined, the platform from the image config is considered.
134+
//
135+
// If the descriptor points to a non-index manifest, then the manifest is
136+
// unmarshalled and returned without considering the platform inside of the
137+
// config.
138+
//
132139
// TODO(stevvooe): This violates the current platform agnostic approach to this
133140
// package by returning a specific manifest type. We'll need to refactor this
134141
// 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
152159
return nil, err
153160
}
154161

155-
if platform != nil {
162+
if desc.Digest != image.Digest && platform != nil {
156163
if desc.Platform != nil && !platform.Match(*desc.Platform) {
157164
return nil, nil
158165
}

0 commit comments

Comments
 (0)