dennismdejong opened a new pull request, #13664:
URL: https://github.com/apache/gravitino/pull/13664
### What changes were proposed in this pull request?
Make the three environment checks called from `printDockerCheckInfo`
treat "not installed" and "not running" as normal states instead of
errors:
- `checkMacDockerConnector` runs `pgrep` directly instead of
`bash -c "pgrep -x -q docker-connector"` and no longer reports exit
code 1, which only means that `docker-connector` is not running.
- `checkDockerStatus` no longer prints a failure line when the `docker`
command is missing or when the Docker server is not running.
- `checkOrbStackStatus` no longer prints a failure line when the `docker`
command is missing.
Unexpected failures (a `pgrep` exit code greater than 1, a missing
`pgrep`, an unexpected `docker context show` exit code) still print a
message naming the command and the exit code or the underlying I/O
error.
### Why are the changes needed?
On macOS without Docker, every Gradle invocation printed:
```
checkContainerRunning failed: Process 'command 'bash'' finished with
non-zero exit value 1
checkDockerStatus failed: Cannot run program "docker": error=2, No such file
or directory
checkOrbStackStatus failed: Cannot run program "docker": error=2, No such
file or directory
```
`project.exec` throws on any non-zero exit code, but `pgrep` returning 1
and a missing `docker` command are both expected when Docker is not
used. The status summary and the tips printed right below the checks
already report those situations, and the old messages did not tell the
user what was wrong or what to do about it.
Fix: #7203
### Does this PR introduce _any_ user-facing change?
Yes, build output only: the three spurious `... failed: ...` lines are
gone, and the remaining messages name the command that failed together
with its exit code. The Docker status summary and the tips are
unchanged.
### How was this patch tested?
`./gradlew help` on macOS without Docker, which is the reported
environment, now prints only the status summary and the tips. The
`docker` and `pgrep` binaries were replaced by stand-ins to exercise
every branch: missing Docker CLI, Docker server not running, Docker
running with an OrbStack context, `pgrep` exit code 0 (docker-connector
detected as running) and `pgrep` exit code 2 (failure reported with the
command and the exit code). `./gradlew :spotlessKotlinGradleCheck`
passes.
The root build script has no unit test infrastructure (`GradleRunner`
and TestKit are not used anywhere in the repository), so the checks were
verified by running Gradle itself in the scenarios listed above.
--
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]