adityamparikh opened a new issue, #336: URL: https://github.com/apache/solr-mcp/issues/336
Status: reproduced on `main` (0b50f37) with Gradle 9.8.2. A fix is sketched below and was tried locally. Size: S. One block in `build.gradle.kts`. ## Problem When there is no `docker` binary on `PATH`, every Gradle command fails, even `./gradlew help`. The task runs and prints its output, and then the build fails while storing the configuration cache: ``` * What went wrong: Configuration cache problems found in this build. 1 problem was found storing the configuration cache. - Build file 'build.gradle.kts': failed to compute value with custom source 'org.gradle.api.internal.provider.sources.process.ProcessOutputValueSource' (output of the external process 'docker') with org.gradle.process.ProcessExecutionException: A problem occurred starting process 'command 'docker'' ``` This affects anyone building without the Docker CLI installed, for example a plain JDK container. I found it while writing a Dockerfile for the Glama listing (#335). That build has to pass `--no-configuration-cache` to get `bootJar` through. It only happens when the binary is missing. If `docker` is installed but the daemon is down, `docker info` exits non-zero, `isIgnoreExitValue = true` handles that, and the build works. ## Reproduce ```bash env -i HOME=$HOME PATH=/usr/bin:/bin JAVA_HOME=<jdk25> ./gradlew --no-daemon help # exit 1 env -i HOME=$HOME PATH=/usr/bin:/bin JAVA_HOME=<jdk25> ./gradlew --no-daemon --no-configuration-cache help # exit 0 ``` ## Cause The `dockerIntegrationTest` configuration ([build.gradle.kts#L438-L451](https://github.com/apache/solr-mcp/blob/0b50f37c22f3c974181d3e1704da60b0e632e654/build.gradle.kts#L438-L451)) probes Docker with `providers.exec { commandLine("docker", "info") }` at configuration time, inside a `try/catch`. The catch handles the exception when the probe runs. But Gradle has already registered the `providers.exec` source as a [build configuration input](https://docs.gradle.org/9.8.2/userguide/configuration_cache.html#config_cache:intro:build_configuration_inputs), and when it stores the cache it computes that input again and fails. Both the probe and `org.gradle.configuration-cache=true` came in with #278. ## Fix Keep the probe, but move it into a custom `ValueSource` whose `obtain()` catches the failure to start and returns `false`. The [configuration-cache docs](https://docs.gradle.org/9.8.2/userguide/configuration_cache_requirements.html#config_cache:requirements:external_processes) document a `ValueSource` with injected `ExecOperations` for running processes at configuration time. Only the `Boolean` it returns is stored as the input. ```kotlin import java.io.OutputStream /** `docker info` succeeds. A missing binary is caught here, so the configuration cache stores `false`. */ abstract class DockerAvailable : ValueSource<Boolean, ValueSourceParameters.None> { @get:javax.inject.Inject abstract val execOperations: ExecOperations override fun obtain(): Boolean = try { execOperations .exec { commandLine("docker", "info") isIgnoreExitValue = true standardOutput = OutputStream.nullOutputStream() errorOutput = OutputStream.nullOutputStream() }.exitValue == 0 } catch (e: org.gradle.process.ProcessExecutionException) { false } } tasks.register<Test>("dockerIntegrationTest") { // ... val dockerAvailable = providers.of(DockerAvailable::class) {}.get() // the rest is unchanged: doFirst { throw … } when false, dependsOn(jibDockerBuild / bootBuildImage) when true } ``` Tried on a clean clone of `main`: | Run | Before | After | |---|---|---| | `help`, no `docker` on `PATH` | exit 1 (error above) | exit 0 | | `help`, `docker` on `PATH` | exit 0 | exit 0 | | `dockerIntegrationTest --dry-run`, `docker` on `PATH` | depends on `:jibDockerBuild` | depends on `:jibDockerBuild` | | `dockerIntegrationTest`, no `docker` on `PATH` | fails at configuration (error above) | fails with "Docker is not available. Please ensure Docker is installed and running." | 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
