From acaf72abf415d81f17ad8b381544cb2c79bc467f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Thu, 17 Oct 2024 23:05:18 +0200 Subject: [PATCH] Improve context for errors in PrepareStagedLayer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Diferentiate partial pull errors from other read errors - Indicate that this is PrepareStagedLayer that is failing Signed-off-by: Miloslav Trmač --- copy/single.go | 2 +- storage/storage_dest.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/copy/single.go b/copy/single.go index 983235158..e008c7e86 100644 --- a/copy/single.go +++ b/copy/single.go @@ -828,7 +828,7 @@ func (ic *imageCopier) copyLayer(ctx context.Context, srcInfo types.BlobInfo, to return false, types.BlobInfo{}, err }() if err != nil { - return types.BlobInfo{}, "", fmt.Errorf("reading blob %s: %w", srcInfo.Digest, err) + return types.BlobInfo{}, "", fmt.Errorf("partial pull of blob %s: %w", srcInfo.Digest, err) } if reused { return blobInfo, cachedDiffID, nil diff --git a/storage/storage_dest.go b/storage/storage_dest.go index 615d6c30e..5612a2a28 100644 --- a/storage/storage_dest.go +++ b/storage/storage_dest.go @@ -335,7 +335,7 @@ func (s *storageImageDestination) PutBlobPartial(ctx context.Context, chunkAcces out, err := s.imageRef.transport.store.PrepareStagedLayer(nil, differ) if err != nil { - return private.UploadedBlob{}, err + return private.UploadedBlob{}, fmt.Errorf("staging a partially-pulled layer: %w", err) } succeeded := false defer func() {