(ctx context.Context, snapshotterName string, manifest ocispec.Manifest, checkSnapshotterSupport bool)
| 422 | } |
| 423 | |
| 424 | func (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 | |
| 446 | func (i *image) ContentStore() content.Store { |
| 447 | return i.client.ContentStore() |
no test coverage detected