MCPcopy Index your code
hub / github.com/linuxkit/linuxkit / validateManifestContents

Function validateManifestContents

src/cmd/linuxkit/cache/pull.go:146–158  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
146func 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.

Callers 1

ValidateImageMethod · 0.85

Calls 1

ImageMethod · 0.65

Tested by

no test coverage detected