Added java 11 to docker-agent - now want to select it in the JDK drop down

I'm using the standard docker agent image (jetbrains/teamcity-agent), and went ahead to add in an older version of java so that I can compile my code with this rather than the standard 17 that comes bundled (used these instructions for guidance). 

The new java version is living in /usr/lib/jvm/java-ll-openjdk-amd64

So now I want to be able to refer to this java version in my build configuration - which I realise is an issue if this is on the agent, but not on the server. I'm planning on adding several more java versions in the future so that I can test that the code can be compiled in the different jdks - so this isn't a once off. 

How do I define parameters on a docker agent that will then be communicated through to the central server (also running in docker at the moment)? If this is how to solve the issue - how does this work with the different agents, if one has the parameter defined and another doesn't? 

 

0
1 comment

Hi! 

If you have the JDK_HOME set to the new java version, you can just use env.JDK_HOME. Otherwise, you can create other environment variables to refer to them as needed (e.g. env.JDK_18, env.JDK_19, etc). I am not sure i fully understood the last two questions, but it seems to me that you only need to manage these build parameters in your TeamCity server and make sure the different agent images you use work well with them in the projects/build configurations where they are used.

0

Please sign in to leave a comment.