Bug 1974338

Summary: [OCP4.7] maven image doesn't use JAVA_HOME env variable
Product: OpenShift Container Platform Reporter: Mario Abajo <mabajodu>
Component: JenkinsAssignee: Akram Ben Aissi <abenaiss>
Status: CLOSED ERRATA QA Contact: Jitendar Singh <jitsingh>
Severity: low Docs Contact: Rolfe Dlugy-Hegwer <rdlugyhe>
Priority: high    
Version: 4.6CC: abenaiss, adam.kaplan, aos-bugs, gmontero, pbhattac, rdlugyhe
Target Milestone: ---   
Target Release: 4.9.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-10-18 17:35:50 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mario Abajo 2021-06-21 12:12:31 UTC
Description of problem:
As of version of openshift 4.5 maven agent image was built using Rhel 7 with maven version 3.5. It was possible to switch java version to 1.8 just adding the JAVA_HOME variable to the pod running the image. But starting with OCP 4.6, the images are now based on rhel 8 and maven 3.6, with this change in version there is also a "/etc/java/maven.conf" containing the JAVA_HOME variable already set to java-11. This seams to take any precedence so setting env variables in the pod to switch the java version is no longer possible.

Version-Release number of selected component (if applicable):
OCP 4.6

How reproducible:
Always

Steps to Reproduce:
1.
2.
3.

Actual results:
Java-11 is always used

Expected results:
Java-11 used by default but possibility to change to java-8 would be expected as with previous versions.

Additional info:

Comment 1 Adam Kaplan 2021-06-21 17:58:00 UTC
JAVA_HOME is not listed as one of the environment variables available to the maven agent image [1].
The maven agent image supports switching the java version via the USE_JAVA_VERSION environment variable. However, this env var is not documented [2].

See also Bug #1861266.

[1] https://docs.openshift.com/container-platform/4.7/openshift_images/using_images/images-other-jenkins-agent.html#images-other-jenkins-agent-env-var_images-other-jenkins-agent
[2] https://github.com/openshift/jenkins/blob/master/slave-base/contrib/bin/run-jnlp-client#L16

Comment 7 Jitendar Singh 2021-09-06 05:27:47 UTC
VERIFIED

Comment 11 errata-xmlrpc 2021-10-18 17:35:50 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: OpenShift Container Platform 4.9.0 bug fix and security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2021:3759

Comment 12 Red Hat Bugzilla 2023-09-15 01:10:14 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 500 days