I have a Jenkins setup in my Kubernetes cluster, but my agents are outside. I connect agents using SSH, but I have one problem with Java.
For my project I must use java 8, however new Jenkins only supports 11 and 17. So in order to launch my node agent and connect, I must remove environment variable from the node settings, start my node, and then add JAVA_HOME jdk1.8.0_151 back to node environment variables. This is very inconvenient, since I have to manually do these steps if Jenkins or the agent get restarted.
I know I could add jdk1.8.0_151 environment variable to my job, but I think this is not very correct way, since I might have several nodes with different path to java8.
So, what may be the correct approach here?