MCPcopy Create free account
hub / github.com/containers/image / ensureManifestIsLoaded

Method ensureManifestIsLoaded

docker/docker_image_src.go:254–272  ·  view source on GitHub ↗

ensureManifestIsLoaded sets s.cachedManifest and s.cachedManifestMIMEType ImageSource implementations are not required or expected to do any caching, but because our signatures are “attached” to the manifest digest, we need to ensure that the digest of the manifest returned by GetManifest(ctx, nil)

(ctx context.Context)

Source from the content-addressed store, hash-verified

252// and used by GetSignatures(ctx, nil) are consistent, otherwise we would get spurious
253// signature verification failures when pulling while a tag is being updated.
254func (s *dockerImageSource) ensureManifestIsLoaded(ctx context.Context) error {
255 if s.cachedManifest != nil {
256 return nil
257 }
258
259 reference, err := s.physicalRef.tagOrDigest()
260 if err != nil {
261 return err
262 }
263
264 manblob, mt, err := s.fetchManifest(ctx, reference)
265 if err != nil {
266 return err
267 }
268 // We might validate manblob against the Docker-Content-Digest header here to protect against transport errors.
269 s.cachedManifest = manblob
270 s.cachedManifestMIMEType = mt
271 return nil
272}
273
274// splitHTTP200ResponseToPartial splits a 200 response in multiple streams as specified by the chunks
275func splitHTTP200ResponseToPartial(streams chan io.ReadCloser, errs chan error, body io.ReadCloser, chunks []private.ImageSourceChunk) {

Callers 3

newImageSourceAttemptFunction · 0.95
GetManifestMethod · 0.95
manifestDigestMethod · 0.95

Calls 2

fetchManifestMethod · 0.95
tagOrDigestMethod · 0.80

Tested by

no test coverage detected