validateManifestContents given an index and a digest, validate that the contents of the manifest are a valid image. This function is network-free. The only validation it does is checks that all of the parts of the image exist.
(index v1.ImageIndex, digest v1.Hash)
| 144 | // manifest are a valid image. This function is network-free. |
| 145 | // The only validation it does is checks that all of the parts of the image exist. |
| 146 | func validateManifestContents(index v1.ImageIndex, digest v1.Hash) error { |
| 147 | img, err := index.Image(digest) |
| 148 | if err != nil { |
| 149 | return fmt.Errorf("unable to get image: %w", err) |
| 150 | } |
| 151 | if _, err := img.ConfigFile(); err != nil { |
| 152 | return fmt.Errorf("unable to get config: %w", err) |
| 153 | } |
| 154 | if _, err := img.Layers(); err != nil { |
| 155 | return fmt.Errorf("unable to get layers: %w", err) |
| 156 | } |
| 157 | return nil |
| 158 | } |
| 159 | |
| 160 | // Pull pull a reference, whether it points to an arch-specific image or to an index. |
| 161 | // If an index, optionally, try to pull its individual named references as well. |