added age-based build retention: artifacts.retentionMaxAge (e.g. 30d, empty = no limit) drops builds older than the given age; combines with retentionPerBranch as independent caps — a build is kept only while it satisfies both limits; a branch's newest build is never age-pruned and keepLatestGreen now shields the latest green build from both limits, keeping the permanent /branches/... links valid
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
b104eeee05
commit
d0b38c557a
@@ -250,7 +250,16 @@ class Watcher(
|
||||
originBranches: List<String>,
|
||||
workingDir: Path,
|
||||
) {
|
||||
repository.prune(originBranches, config.artifacts.retentionPerBranch, config.artifacts.keepLatestGreen)
|
||||
val retentionCutoff =
|
||||
config.artifacts.retentionMaxAge
|
||||
.takeIf { it.isNotBlank() }
|
||||
?.let { clock.instant().minus(DurationParser.parse(it)) }
|
||||
repository.prune(
|
||||
originBranches,
|
||||
config.artifacts.retentionPerBranch,
|
||||
config.artifacts.keepLatestGreen,
|
||||
retentionCutoff,
|
||||
)
|
||||
artifactStore.prune(repository.history())
|
||||
pruneWorktrees(originBranches, workingDir)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user