Disabling the gradle daemon with kubernetes/container based builds?

In this guide its recommended to enable the gradle daemon even for CI builds:
https://docs.gradle.org/current/userguide/gradle_daemon.html#when_should_i_not_use_the_gradle_daemon

Continuous integration

Since Gradle 3.0, we enable Daemon by default and recommend using it for both developers’ machines and Continuous Integration servers. However, if you suspect that Daemon makes your CI builds unstable, you can disable it to use a fresh runtime for each build since the runtime is completely isolated from any previous builds.

I assume that does NOT apply for builds running in e.g. dynamic build pods/containers launched via jenkins in kubernetes? In those cases I don’t see the point of enabling the daemon since each build is run in a fresh container or am I missing something?

Actually it is pointless either way in such a situation, because telling Gradle to not use a daemon essentially just means that no daemon is reused and that the used daemon will not be reused by further builds. But the build always runs in a daemon, “without” daemon the daemon is just always freshly started and in the end exited. But as you start a new container and throw away the container, it is the same either way.

gradle --no-daemon might save limited container RAM… if you have more actions not requiring Gradle.

Otherwise the container will be disposed together with Gradle ))

1 Like