@@ -475,7 +475,7 @@ func (cleaner *LocalBackendCleaner) pruneImages(ctx context.Context, options Run
475475 if options .DryRun {
476476 list , err := cleaner .backend .Images (ctx , buildImagesOptions (filters .ToPairs ()... ))
477477 if err != nil {
478- return newCleanupReport (0 ), err
478+ return newCleanupReport (), err
479479 }
480480 return mapImageListToCleanupReport (list ), nil
481481 }
@@ -485,9 +485,9 @@ func (cleaner *LocalBackendCleaner) pruneImages(ctx context.Context, options Run
485485 case errors .Is (err , container_backend .ErrImageUsedByContainer ),
486486 errors .Is (err , container_backend .ErrPruneIsAlreadyRunning ):
487487 logboek .Context (ctx ).Info ().LogF ("NOTE: Ignore image pruning: %s\n " , err .Error ())
488- return newCleanupReport (0 ), nil
488+ return newCleanupReport (), nil
489489 case err != nil :
490- return newCleanupReport (0 ), err
490+ return newCleanupReport (), err
491491 }
492492
493493 return mapPruneReportToCleanupReport (report ), err
@@ -498,17 +498,17 @@ func (cleaner *LocalBackendCleaner) pruneVolumes(ctx context.Context, options Ru
498498 if options .DryRun {
499499 // NOTE: Buildah does not give us a way to precalculate pruned size.
500500 // NOTE: Docker does not give us a way to precalculate pruned size.
501- return newCleanupReport (0 ), errOptionDryRunNotSupported
501+ return newCleanupReport (), errOptionDryRunNotSupported
502502 }
503503
504504 report , err := cleaner .backend .PruneVolumes (ctx , prune.Options {})
505505
506506 switch {
507507 case errors .Is (err , container_backend .ErrPruneIsAlreadyRunning ):
508508 logboek .Context (ctx ).Info ().LogF ("NOTE: Ignore volume pruning: %s\n " , err .Error ())
509- return newCleanupReport (0 ), nil
509+ return newCleanupReport (), nil
510510 case err != nil :
511- return newCleanupReport (0 ), err
511+ return newCleanupReport (), err
512512 }
513513
514514 return mapPruneReportToCleanupReport (report ), err
@@ -517,10 +517,11 @@ func (cleaner *LocalBackendCleaner) pruneVolumes(ctx context.Context, options Ru
517517func (cleaner * LocalBackendCleaner ) cleanupWerfContainers (ctx context.Context , options RunGCOptions , vu volumeutils.VolumeUsage ) (cleanupReport , error ) {
518518 containers , err := werfContainersByContainersOptions (ctx , cleaner .backend , buildContainersOptions ())
519519 if err != nil {
520- return newCleanupReport (0 ), fmt .Errorf ("cannot get build containers: %w" , err )
520+ return newCleanupReport (), fmt .Errorf ("cannot get build containers: %w" , err )
521521 }
522522
523- report := newCleanupReport (len (containers ))
523+ report := newCleanupReport ()
524+ report .ItemsDeleted = make ([]string , 0 , len (containers ))
524525
525526 for _ , container := range containers {
526527 containerName := werfContainerName (container )
@@ -531,7 +532,7 @@ func (cleaner *LocalBackendCleaner) cleanupWerfContainers(ctx context.Context, o
531532 }
532533
533534 if ok , err := cleaner .isLocked (container_backend .ContainerLockName (containerName )); err != nil {
534- return newCleanupReport (0 ), fmt .Errorf ("checking lock %q: %w" , container_backend .ContainerLockName (containerName ), err )
535+ return newCleanupReport (), fmt .Errorf ("checking lock %q: %w" , container_backend .ContainerLockName (containerName ), err )
535536 } else if ok {
536537 continue
537538 }
@@ -569,10 +570,10 @@ func (cleaner *LocalBackendCleaner) cleanupWerfContainers(ctx context.Context, o
569570func (cleaner * LocalBackendCleaner ) cleanupWerfImages (ctx context.Context , options RunGCOptions , vu volumeutils.VolumeUsage , targetVolumeUsagePercentage float64 ) (cleanupReport , error ) {
570571 images , err := cleaner .werfImages (ctx )
571572 if err != nil {
572- return newCleanupReport (0 ), err
573+ return newCleanupReport (), err
573574 }
574575
575- report := newCleanupReport (0 )
576+ report := newCleanupReport ()
576577
577578 tVu := targetVolumeUsagePercentage
578579
0 commit comments