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:
co-authored by
Claude Fable 5
parent
76321a6f5c
commit
ed9562d1a7
@@ -5,6 +5,7 @@ import io.kotest.core.spec.style.FunSpec
|
||||
import io.kotest.matchers.booleans.shouldBeFalse
|
||||
import io.kotest.matchers.booleans.shouldBeTrue
|
||||
import io.kotest.matchers.collections.shouldContainExactly
|
||||
import io.kotest.matchers.nulls.shouldNotBeNull
|
||||
import io.kotest.matchers.shouldBe
|
||||
import io.kotest.matchers.string.shouldContain
|
||||
import java.nio.file.Files
|
||||
@@ -30,6 +31,15 @@ class GitCommandRunnerTest : FunSpec() {
|
||||
result.stdout.trim() shouldBe tempDir.toRealPath().toString()
|
||||
}
|
||||
|
||||
test("hands the started process to onProcess, so callers can terminate it early") {
|
||||
var seen: Process? = null
|
||||
|
||||
val result = runner.run(listOf("sh", "-c", "sleep 30"), tempDir, onProcess = { seen = it.also(Process::destroy) })
|
||||
|
||||
result.isSuccess.shouldBeFalse()
|
||||
seen.shouldNotBeNull().isAlive.shouldBeFalse()
|
||||
}
|
||||
|
||||
test("passes extra environment variables") {
|
||||
val result = runner.run(listOf("sh", "-c", "echo \"\$GITTALLY_TEST_VAR\""), tempDir, mapOf("GITTALLY_TEST_VAR" to "hello"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user