Skip to content

Commit

Permalink
c8d/image_manifest: IsPseudoImage return true for unknown/unknown pla…
Browse files Browse the repository at this point in the history
…tform

Signed-off-by: Paweł Gronowski <[email protected]>
  • Loading branch information
vvoland committed Jun 10, 2024
1 parent b4d2283 commit 8d96d75
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion daemon/containerd/image_manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,24 @@ func (im *ImageManifest) IsAttestation() bool {
return false
}

// IsPseudoImage returns false if the manifest has no layers or any of its layers is a known image layer.
// IsPseudoImage returns false when any of the below is true:
// - The manifest has no layers
// - None of its layers is a known image layer.
// - The manifest has unknown/unknown platform.
//
// Some manifests use the image media type for compatibility, even if they are not a real image.
func (im *ImageManifest) IsPseudoImage(ctx context.Context) (bool, error) {
if im.IsAttestation() {
return true, nil
}

plat := im.Target().Platform
if plat != nil {
if plat.OS == "unknown" && plat.Architecture == "unknown" {
return true, nil
}
}

mfst, err := im.Manifest(ctx)
if err != nil {
if cerrdefs.IsNotFound(err) {
Expand Down

0 comments on commit 8d96d75

Please sign in to comment.