builder: support for images without layers
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com> Upstream-commit: 9328f0479b810c76fd5944bf9c856cea1af0c498 Component: engine
This commit is contained in:
@@ -293,6 +293,9 @@ func (p *puller) Snapshot(ctx context.Context) (cache.ImmutableRef, error) {
|
||||
if p.config != nil {
|
||||
img, err := p.is.ImageStore.Get(image.ID(digest.FromBytes(p.config)))
|
||||
if err == nil {
|
||||
if len(img.RootFS.DiffIDs) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
ref, err := p.is.CacheAccessor.GetFromSnapshotter(ctx, string(img.RootFS.ChainID()), cache.WithDescription(fmt.Sprintf("from local %s", p.ref)))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -431,6 +434,10 @@ func (p *puller) Snapshot(ctx context.Context) (cache.ImmutableRef, error) {
|
||||
}
|
||||
}()
|
||||
|
||||
if len(mfst.Layers) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
layers := make([]xfer.DownloadDescriptor, 0, len(mfst.Layers))
|
||||
|
||||
for i, desc := range mfst.Layers {
|
||||
|
||||
Reference in New Issue
Block a user