[FEATURE]: Ability to use System JDK for Jib
See original GitHub issueFeature Request
Garden Jib Provider should allow using the JDK installed on the System.
Background / Motivation
- Support environments with alternate libc libraries, for example Alpine. If Garden runs in an Alpine container, JDK will not work because it depends on
glibc
, while alpine ships withmusl
. Executing thejava
binary results in aNot Found
error, as shared libarary glibc cannot be found. - Support for any alternate JDK version / distribution. With this option you can use prerelease versions or alternative JDK distributions.
Costs
- This would come with the cost that different team members might end up using different versions. That is a trade our customers can make for themselves with this feature.
- In many cases, glibc compatibility libraries could be the better option. We could document this. Alpine Example: https://stackoverflow.com/a/68284294
What should the user be able to do?
If users specify the sdkVersion: system
, it should detect system-installed JDK using PATH and/or JAVA_HOME env variables, and use that instead of downloading jdk.
Why do they want to do this? What problem does it solve?
There is a workaround of downloading the dependencies, and then symlinking the .garden/tools/openjdk-xx
folder with the system java. But this solution is brittle and hacky. Official support for this use case saves developers who need this a lot of time on hacking a solution together.
Suggested Implementation(s)
Allow garden yaml option jdkVersion: system
or useSystemJDK: true
. Code location: https://github.com/garden-io/garden/blob/master/plugins/jib/index.ts#L51
if this option is specified, garden should autodetect the system JDK and use that instead of downloading it.
How important is this feature for you/your team?
π΅ Not having this feature makes using Garden painful
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:10 (2 by maintainers)
@stefreak @vvagaytsev
A custom gradlePath seems like a good option.
Hereβs more for context β¦
My project uses a custom Gradle 7.5.1.
Iβm using Rancher-Desktop with Kubernetes 1.24.8+k3s1.
I use a private artifactory repository. The dependencies that the build fails on are supposed to come from artifactory. Iβm logged into artifactory in my host os/shell. The garden build doesnβt seem to be able to use that though.
My project directory structure looks like this:
When I run
garden dev
the apps/* builds fail with a message like this:Because β¦
apps/app1
depends oncore
core
depends onlibA
andlibB
, both of which come from a private artifactory⦠the whole build fails.
The simplest solution is to ignore the JDK -related settings if an explicit
mavenPath
is specified. This means weβll just use the provided Maven binary as it is. It seems natural to assume that the local Maven is configured properly β it means that thejava
command is already defined in thePATH
.