Skip to content

Commit 33c49e5

Browse files
committed
Fix OCI prune cleanup of broken tag symlinks
1 parent 4ce8a11 commit 33c49e5

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Sources/tart/Commands/Prune.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ struct Prune: AsyncParsableCommand {
7272
if let spaceBudget = spaceBudget {
7373
try Prune.pruneSpaceBudget(prunableStorages: prunableStorages, spaceBudgetBytes: UInt64(spaceBudget) * 1024 * 1024 * 1024)
7474
}
75+
76+
// Pruning digest-addressed OCI images can leave their tag symlinks broken.
77+
// Run garbage collection after deletion so it can remove those links.
78+
if entries == "caches" && (olderThan != nil || spaceBudget != nil) {
79+
try VMStorageOCI().gc()
80+
}
7581
}
7682

7783
static func pruneOlderThan(prunableStorages: [PrunableStorage], olderThanDate: Date) throws {

0 commit comments

Comments
 (0)