admin管理员组文章数量:1332383
We are using Jenkins with Docker Cloud Agents. Our build image contains several jdk (8, 11, 17, 21). Our jobs are using Jenkinsfiles from the Git Repos.
To select the proper jdk for a build we use the following:
#!groovy
pipeline {
agent {
label 'our-label-name'
}
tools {
jdk 'adoptOpenJDK-8'
}
...
}
Setting the jdk results in the correct value for JAVA_HOME and also PATH contains the proper jdk installation.
But LD_LIBRARY_PATH does always contain the path to jdk 17. (I'm not sure why always exactly 17. Perhaps because jenkins and agent is running on this version.)
So the result is like this:
JAVA_HOME=/usr/lib/jvm/java-8-openjdk
PATH=/usr/lib/jvm/java-8-openjdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
LD_LIBRARY_PATH=/usr/lib/jvm/java-17-openjdk/lib/server:/usr/lib/jvm/java-17-openjdk/lib:/usr/lib/jvm/java-17-openjdk/../lib
And with this setting the wrong java version is used:
java -version
openjdk version "17.0.10" 2024-01-16
When I manually clean LD_LIBRARY_PATH the correct java version is used.
So why isn't LD_LIBRARY_PATH pointing to the correct jdk?
Or if unknown why this is happending, what can I do to achieve this? As we have hundreds of jobs, added some manual setting of LD_LIBRARY_PATH to each job is not a valid solution. If there is just one config place to fix this, it would be ok.
本文标签:
版权声明:本文标题:java - Why is LD_LIBRARY_PATH pointing to the wrong jdk when using Jenkins with Docker Cloud Agents? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742304290a2449602.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论