Skip to content

c8d: improve pull errors (non-matching platform, etc) #46765

@thaJeztah

Description

@thaJeztah

The containerd error is less informative than the old one, because it doesn't show WHAT we weren't able to match (which could be obvious if a user explicitly passed a --platform, but less so if not, but could also be that user passed a partial platform, and we normalized it).

The "non-snapshotter" error looks to be this one;

type noMatchesErr struct {
platform ocispec.Platform
}
func (e noMatchesErr) Error() string {
return fmt.Sprintf("no matching manifest for %s in the manifest list entries", formatPlatform(e.platform))
}

For containerd, the error is produced here;

if len(children) == 0 {
return children, fmt.Errorf("no match for platform in manifest: %w", errdefs.ErrNotFound)
}

I guess ideally the containerd error would be somewhat more informative (what were we trying to match, and couldn't find?), but it looks like that's less trivial, because that's fully up to the HandlerFunc that's passed (which does the filtering).

The alternative here would be to handle this on our side: when we get the result. The error returned is typed; it's a errdefs.ErrNotFound, so we can decorate the error (and perhaps we can decorate it regardless of what the reason was), i.e.;

if cerrdefs.IsNotFound(err) {
    err = fmt.Errorf("no matching manifest for %s: %w", formatPlatform(e.platform), err)
} else {
    err = fmt.Errorf("failed to find matching manifest for %s: %w", formatPlatform(e.platform), err)
}

(I removed "in the manifest list entries" from the above, but maybe we should keep it, not sure if it's "too much")

Metadata

Metadata

Assignees

Labels

Projects

Status

Required for default containerd

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions