openshift / jenkins

Apache License 2.0
260 stars 447 forks source link

Switching Java versions by specifying USE_JAVA_VERSION no longer works #1712

Closed dominik0711 closed 3 months ago

dominik0711 commented 10 months ago

Hi team,

I have noticed that the commit from May 11 2023, removes the possibility to set the JAVA_VERSION by providing the environment variable USE_JAVA_VERSION for the shell script: run-jnlp-client

This setting of the Java version is described in BASIC_USAGE.md

We rely on this possibility in our own jenkins-agent-builder images that use your image as our base. The script run-jnlp-client still has the variable JAVA-VERSION but the given value will not be used anymore.

The script: run-jnlp-client pins the java version to the default value java-11 and can't be set from outside.

To make this work again, the deleted code needs to be reintroduced again:

if [[ "$(uname -m)" == "x86_64" ]]; then
    alternatives --set java $(alternatives --display java | grep $JAVA_VERSION | awk '/family.*x86_64/ { print $1; }')
    alternatives --set javac $(alternatives --display javac | grep $JAVA_VERSION | awk '/family.*x86_64/ { print $1; }')
#set JVM for all other archs
else
  alternatives --set java $(alternatives --display java | grep $JAVA_VERSION | awk '/family.*'$(uname -m)'/ { print $1; }')
  alternatives --set javac $(alternatives --display javac | grep $JAVA_VERSION | awk '/family.*'$(uname -m)'/ { print $1; }')
fi
simonkrenger commented 8 months ago

I have created https://issues.redhat.com/browse/OCPBUGS-24387 to track this on the Red Hat side

openshift-bot commented 5 months ago

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close. Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

openshift-bot commented 4 months ago

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity. Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten /remove-lifecycle stale

simonkrenger commented 4 months ago

/remove-lifecycle rotten