Let cancel terminate auxiliary build phases instead of blocking the slot

Cancelling a build only killed the running build process; the synchronous
preparation phases — most notably a multi-minute Docker image build, but also
the Gradle-volume preparation — ran to completion and kept the concurrency
slot occupied, so the next queued build stayed PENDING for a long time.
Build runners now report every auxiliary process through an onAuxProcess sink
(GitCommandRunner gained an onProcess hook), and the executor registers them
like the build process, so cancellation terminates whatever is currently
running. Measured on vm4006: cancel to next-build-running is ~3s in the
normal case; the unit test covers the aux-phase case.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
mhoennig
2026-08-10 16:14:38 +02:00
co-authored by Claude Fable 5
parent 76321a6f5c
commit ed9562d1a7
8 changed files with 107 additions and 23 deletions
@@ -118,7 +118,7 @@ class NginxProxyManagerTest : FunSpec() {
sleepCount = 0
repoDir = Files.createTempDirectory("gittally-nginx-repo")
stateDir = Files.createTempDirectory("gittally-nginx-state")
every { commandRunner.run(capture(captured), any(), any()) } answers {
every { commandRunner.run(capture(captured), any(), any(), any()) } answers {
if (captured.last().take(3) == listOf("docker", "run", "-d")) {
configsAtContainerRun += Files.readString(stateDir.resolve("nginx/nginx.conf"))
}
@@ -246,7 +246,7 @@ class NginxProxyManagerTest : FunSpec() {
test("does not start while a foreign container occupies an nginx port") {
every { configLoader.load(repoDir) } returns nginxConfig()
every {
commandRunner.run(match { it.take(2) == listOf("docker", "ps") && it.contains("--format") }, any(), any())
commandRunner.run(match { it.take(2) == listOf("docker", "ps") && it.contains("--format") }, any(), any(), any())
} returns GitCommandResult(0, "abc123\tother-app\t0.0.0.0:8080->80/tcp\tvendor=other", "")
manager.start()
@@ -258,7 +258,7 @@ class NginxProxyManagerTest : FunSpec() {
test("removes a stale gittally-named container occupying an nginx port") {
every { configLoader.load(repoDir) } returns nginxConfig()
every {
commandRunner.run(match { it.take(2) == listOf("docker", "ps") && it.contains("--format") }, any(), any())
commandRunner.run(match { it.take(2) == listOf("docker", "ps") && it.contains("--format") }, any(), any(), any())
} returnsMany
listOf(
GitCommandResult(0, "abc123\tgittally-nginx-old\t0.0.0.0:8080->80/tcp\t", ""),
@@ -304,7 +304,7 @@ class NginxProxyManagerTest : FunSpec() {
test("a docker failure never throws — the HTTP server keeps running") {
every { configLoader.load(repoDir) } returns nginxConfig()
every { commandRunner.run(any(), any(), any()) } throws RuntimeException("docker: command not found")
every { commandRunner.run(any(), any(), any(), any()) } throws RuntimeException("docker: command not found")
manager.start()
}