Install a nightly Docker cleanup timer with init --systemd (v0.9.7)
Port of the legacy host's docker-prune.timer: 02:00 host time, Persistent=true, docker system prune -af — but without --volumes, so the per-repository Gradle cache volumes survive. The units are host-global; several GitTally instances share one timer. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
74bc4c2d73
commit
e1f3f5f384
@@ -3,6 +3,7 @@ package de.hoennig.gittally.commands
|
||||
import io.kotest.core.spec.style.FunSpec
|
||||
import io.kotest.matchers.shouldBe
|
||||
import io.kotest.matchers.string.shouldContain
|
||||
import io.kotest.matchers.string.shouldNotContain
|
||||
import java.nio.file.Paths
|
||||
|
||||
class SystemdServiceFilesTest : FunSpec() {
|
||||
@@ -46,6 +47,24 @@ class SystemdServiceFilesTest : FunSpec() {
|
||||
content shouldContain """-jar "/srv/100%%-repo/gittally.jar" server"""
|
||||
}
|
||||
|
||||
test("prune service cleans containers and images but never volumes") {
|
||||
val content = SystemdServiceFiles.pruneServiceContent()
|
||||
|
||||
content shouldContain "Type=oneshot"
|
||||
content shouldContain "ExecStart=docker system prune -af"
|
||||
// the per-repository Gradle cache volumes must survive the cleanup
|
||||
content shouldNotContain "--volumes"
|
||||
content shouldContain "ExecCondition=sh -c 'command -v docker'"
|
||||
}
|
||||
|
||||
test("prune timer fires nightly at 02:00 and catches up after downtime") {
|
||||
val content = SystemdServiceFiles.pruneTimerContent()
|
||||
|
||||
content shouldContain "OnCalendar=*-*-* 02:00:00"
|
||||
content shouldContain "Persistent=true"
|
||||
content shouldContain "WantedBy=timers.target"
|
||||
}
|
||||
|
||||
test("environment file template only tunes the JVM") {
|
||||
val content = SystemdServiceFiles.envFileContent()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user