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)
| 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. |
| 254 | func (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 |
| 275 | func splitHTTP200ResponseToPartial(streams chan io.ReadCloser, errs chan error, body io.ReadCloser, chunks []private.ImageSourceChunk) { |
no test coverage detected