Skip to content

Let Jenkins define environment variables for all its java installations

Summary

Currently there are some java installations under /opt/tools/java/, I haven't found out yet how to get a list of all of them and their path but an example is /opt/tools/java/openjdk/jdk-24/jdk-24

What is the current bug behavior?

It is not easy to automatically discover those installations or use them in scripts

What is the expected correct behavior?

The setup-java Github action defines for each java installation an environment variable of the the form JAVA_HOME_{{ MAJOR_VERSION }}_{{ ARCHITECTURE }} (for example it would be JAVA_HOME_21_X64 for Java 21) this allows quite convenient selection of a java installation apart from the defaults to run a certain command for example env JAVA_HOME=${JAVA_HOME_21_X64} java --version

It would be good if the Jenkins nodes can be configured to follow this convention to make it easier to run workflows on Jenkins and Github in a unified manner.

Priority

  • Urgent
  • High
  • Medium
  • Low

Severity

  • Blocker
  • Major
  • Normal
  • Low

Impact

Currently one has to find out the path and possibly define the variables manually.