(imageName string, platform imagespec.Platform)
| 48 | } |
| 49 | |
| 50 | func (p *Provider) findImage(imageName string, platform imagespec.Platform) (v1.Image, error) { |
| 51 | root, err := p.FindRoot(imageName) |
| 52 | if err != nil { |
| 53 | return nil, err |
| 54 | } |
| 55 | img, err := root.Image() |
| 56 | if err == nil { |
| 57 | return img, nil |
| 58 | } |
| 59 | ii, err := root.ImageIndex() |
| 60 | if err == nil { |
| 61 | // we have the index, get the manifest that represents the manifest for the desired architecture |
| 62 | platform := v1.Platform{OS: platform.OS, Architecture: platform.Architecture} |
| 63 | images, err := partial.FindImages(ii, matchPlatformsOSArch(platform)) |
| 64 | if err != nil || len(images) < 1 { |
| 65 | return nil, fmt.Errorf("error retrieving image %s for platform %v from cache: %v", imageName, platform, err) |
| 66 | } |
| 67 | return images[0], nil |
| 68 | } |
| 69 | return nil, fmt.Errorf("no image found for %s", imageName) |
| 70 | } |
| 71 | |
| 72 | func (p *Provider) findIndex(imageName string) (v1.ImageIndex, error) { |
| 73 | root, err := p.FindRoot(imageName) |
no test coverage detected