From 779875a057ff98e9b754371c193fe3b0c23ae7a2 Mon Sep 17 00:00:00 2001 From: Edgar Lee Date: Tue, 29 Aug 2023 15:34:19 -0700 Subject: [PATCH] Add missing unpacker.Wait for image import - For remote snapshotters, the unpack phase serves as an important step for preparing the remote snapshot. With the missing unpacker.Wait, the snapshotter `Prepare` context is always canceled. - This patch allows remote snapshotter based archives to be imported via the transfer service or `ctr image import` Signed-off-by: Edgar Lee --- pkg/transfer/local/import.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/transfer/local/import.go b/pkg/transfer/local/import.go index cf9944c72..6ccc4f1f9 100644 --- a/pkg/transfer/local/import.go +++ b/pkg/transfer/local/import.go @@ -113,10 +113,20 @@ func (ts *localTransferService) importStream(ctx context.Context, i transfer.Ima } if err := images.WalkNotEmpty(ctx, handler, index); err != nil { + if unpacker != nil { + // wait for unpacker to cleanup + unpacker.Wait() + } // TODO: Handle Not Empty as a special case on the input return err } + if unpacker != nil { + if _, err = unpacker.Wait(); err != nil { + return err + } + } + for _, desc := range descriptors { imgs, err := is.Store(ctx, desc, ts.images) if err != nil {