@@ -35,7 +35,7 @@ import (
3535
3636 "github.com/google/go-containerregistry/pkg/authn"
3737 "github.com/google/go-containerregistry/pkg/name"
38- "github.com/google/go-containerregistry/pkg/v1"
38+ v1 "github.com/google/go-containerregistry/pkg/v1"
3939 "github.com/google/go-containerregistry/pkg/v1/empty"
4040 "github.com/google/go-containerregistry/pkg/v1/mutate"
4141 "github.com/google/go-containerregistry/pkg/v1/remote"
@@ -261,6 +261,9 @@ func (p DataProcessor) inspectAndStreamSourceImage(
261261 klog .Infoln ("Streaming from the source" )
262262 doneSize , err := io .Copy (streamWriter , io .TeeReader (sourceImageReader , imageInfoWriter ))
263263 if err != nil {
264+ if importerrs .IsNoSpaceLeftError (err ) {
265+ return importerrs .NewNoSpaceLeftError (err )
266+ }
264267 return fmt .Errorf ("error copying from the source: %w" , err )
265268 }
266269
@@ -325,6 +328,9 @@ func (p DataProcessor) uploadLayersAndImage(
325328
326329 klog .Infoln ("Uploading layer to registry" )
327330 if err := remote .WriteLayer (repo , layer , remoteOpts ... ); err != nil {
331+ if importerrs .IsNoSpaceLeftError (err ) {
332+ return importerrs .NewNoSpaceLeftError (err )
333+ }
328334 return fmt .Errorf ("error uploading layer: %w" , err )
329335 }
330336 klog .Infoln ("Layer uploaded" )
@@ -356,6 +362,9 @@ func (p DataProcessor) uploadLayersAndImage(
356362
357363 klog .Infof ("Uploading image %q to registry" , p .destImageName )
358364 if err = remote .Write (ref , image , remoteOpts ... ); err != nil {
365+ if importerrs .IsNoSpaceLeftError (err ) {
366+ return importerrs .NewNoSpaceLeftError (err )
367+ }
359368 return fmt .Errorf ("error uploading image: %w" , err )
360369 }
361370
@@ -403,6 +412,9 @@ func getImageInfo(ctx context.Context, sourceReader io.ReadCloser) (ImageInfo, e
403412
404413 uncompressedN , err = io .CopyN (tempImageInfoFile , formatSourceReaders .TopReader (), imageInfoSize )
405414 if err != nil && ! errors .Is (err , io .EOF ) {
415+ if importerrs .IsNoSpaceLeftError (err ) {
416+ return ImageInfo {}, importerrs .NewNoSpaceLeftError (err )
417+ }
406418 return ImageInfo {}, fmt .Errorf ("error writing to temp file: %w" , err )
407419 }
408420
@@ -430,6 +442,9 @@ func getImageInfo(ctx context.Context, sourceReader io.ReadCloser) (ImageInfo, e
430442 // It's necessary to read everything from the original image to avoid blocking.
431443 _ , err = io .Copy (& EmptyWriter {}, sourceReader )
432444 if err != nil {
445+ if importerrs .IsNoSpaceLeftError (err ) {
446+ return ImageInfo {}, importerrs .NewNoSpaceLeftError (err )
447+ }
433448 return ImageInfo {}, fmt .Errorf ("error copying to nowhere: %w" , err )
434449 }
435450
@@ -458,6 +473,9 @@ func getImageInfo(ctx context.Context, sourceReader io.ReadCloser) (ImageInfo, e
458473 // Count uncompressed size of source image.
459474 n , err := io .Copy (& EmptyWriter {}, formatSourceReaders .TopReader ())
460475 if err != nil {
476+ if importerrs .IsNoSpaceLeftError (err ) {
477+ return ImageInfo {}, importerrs .NewNoSpaceLeftError (err )
478+ }
461479 return ImageInfo {}, fmt .Errorf ("error copying to nowhere: %w" , err )
462480 }
463481
0 commit comments