Skip to content

Commit

Permalink
Add missing unpacker.Wait for image import
Browse files Browse the repository at this point in the history
- 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 <edgarhinshunlee@gmail.com>
  • Loading branch information
hinshun committed Feb 18, 2024
1 parent 31ea2d7 commit 8fe0b26
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/transfer/local/import.go
Expand Up @@ -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 {
Expand Down

0 comments on commit 8fe0b26

Please sign in to comment.