MCPcopy
hub / github.com/containerd/containerd / checkSnapshotterSupport

Method checkSnapshotterSupport

client/image.go:424–444  ·  view source on GitHub ↗
(ctx context.Context, snapshotterName string,
	manifest ocispec.Manifest, checkSnapshotterSupport bool)

Source from the content-addressed store, hash-verified

422}
423
424func (i *image) checkSnapshotterSupport(ctx context.Context, snapshotterName string,
425 manifest ocispec.Manifest, checkSnapshotterSupport bool) error {
426 manifestPlatform, err := images.ConfigPlatform(ctx, i.ContentStore(), manifest.Config)
427 if err != nil {
428 return err
429 }
430
431 if len(manifestPlatform.OSFeatures) == 0 && !checkSnapshotterSupport {
432 return nil
433 }
434
435 snapshotterPlatformMatcher, err := i.client.GetSnapshotterSupportedPlatforms(ctx, snapshotterName)
436 if err != nil {
437 return err
438 }
439
440 if snapshotterPlatformMatcher.Match(manifestPlatform) {
441 return nil
442 }
443 return fmt.Errorf("snapshotter %s does not support platform %s for image %s", snapshotterName, manifestPlatform, manifest.Config.Digest)
444}
445
446func (i *image) ContentStore() content.Store {
447 return i.client.ContentStore()

Callers 1

UnpackMethod · 0.95

Calls 4

ContentStoreMethod · 0.95
ConfigPlatformFunction · 0.92
MatchMethod · 0.65

Tested by

no test coverage detected