Fixes needed to vendor buildkit into moby

Signed-off-by: Tibor Vass <tibor@docker.com>
v0.8
Tibor Vass 2020-11-12 23:36:16 +00:00
parent e68c2bc12f
commit 9dabe0545f
2 changed files with 11 additions and 2 deletions

2
cache/manager.go vendored
View File

@ -106,7 +106,7 @@ func (cm *cacheManager) GetByBlob(ctx context.Context, desc ocispec.Descriptor,
blobChainID := imagespecidentity.ChainID([]digest.Digest{desc.Digest, diffID})
descHandlers := descHandlersOf(opts...)
if descHandlers == nil || descHandlers[desc.Digest] == nil {
if desc.Digest != "" && (descHandlers == nil || descHandlers[desc.Digest] == nil) {
if _, err := cm.ContentStore.Info(ctx, desc.Digest); errors.Is(err, errdefs.ErrNotFound) {
return nil, NeedsRemoteProvidersError([]digest.Digest{desc.Digest})
} else if err != nil {

11
cache/refs.go vendored
View File

@ -147,7 +147,12 @@ func (cr *cacheRecord) isLazy(ctx context.Context) (bool, error) {
if !getBlobOnly(cr.md) {
return false, nil
}
_, err := cr.cm.ContentStore.Info(ctx, digest.Digest(getBlob(cr.md)))
dgst := getBlob(cr.md)
// special case for moby where there is no compressed blob (empty digest)
if dgst == "" {
return false, nil
}
_, err := cr.cm.ContentStore.Info(ctx, digest.Digest(dgst))
if errors.Is(err, errdefs.ErrNotFound) {
return true, nil
}
@ -457,6 +462,10 @@ func (sr *immutableRef) extract(ctx context.Context, dhs DescHandlers, s session
return nil, nil
}
if sr.cm.Applier == nil {
return nil, errors.New("extract requires an applier")
}
eg, egctx := errgroup.WithContext(ctx)
parentID := ""