1
0
mirror of https://github.com/distribution/distribution synced 2024-11-06 19:35:52 +01:00

fix: skip removing layer's link file when '--dry-run' option specified (#4425)

This commit is contained in:
Milos Gajdos 2024-08-05 11:55:46 +01:00 committed by GitHub
commit ad737939a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -169,6 +169,10 @@ func MarkAndSweep(ctx context.Context, storageDriver driver.StorageDriver, regis
for repo, dgsts := range deleteLayerSet {
for _, dgst := range dgsts {
emit("%s: layer link eligible for deletion: %s", repo, dgst)
if opts.DryRun {
continue
}
err = vacuum.RemoveLayer(repo, dgst)
if err != nil {
return fmt.Errorf("failed to delete layer link %s of repo %s: %v", dgst, repo, err)