Skip to content

Commit 910e9b2

Browse files
committed
[a2a] Do not build test python server image if no docker installed
1 parent f499b63 commit 910e9b2

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

a2a/a2a-client/build.gradle.kts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import ai.koog.gradle.publish.maven.Publishing.publishToMaven
2+
import org.gradle.kotlin.dsl.support.serviceOf
3+
import java.io.ByteArrayOutputStream
24

35
group = rootProject.group
46
version = rootProject.version
@@ -59,6 +61,23 @@ tasks.register<Exec>("dockerBuildTestPythonA2AServer") {
5961
description = "Build Python A2A test server image"
6062
workingDir = file("../test-python-a2a-server")
6163
commandLine = listOf("docker", "build", "-t", "test-python-a2a-server", ".")
64+
65+
onlyIf {
66+
val buffer = ByteArrayOutputStream()
67+
val result = serviceOf<ExecOperations>().exec {
68+
commandLine = listOf("docker", "--version")
69+
isIgnoreExitValue = true
70+
standardOutput = buffer
71+
errorOutput = buffer
72+
}
73+
74+
val available = result.exitValue == 0
75+
if (!available) {
76+
logger.warn("Docker not found. Skipping task 'dockerBuildTestPythonA2AServer'")
77+
}
78+
79+
available
80+
}
6281
}
6382

6483
tasks.named("jvmTest") {

0 commit comments

Comments
 (0)