microsoft / azure-pipelines-agent

Azure Pipelines Agent 🚀
MIT License
1.73k stars 869 forks source link

Self Hosted RHEL Azure Pipelines Agents do not detect Oracle JDK installation #5050

Open manselp opened 4 days ago

manselp commented 4 days ago

Describe your question

Our self hosted RHEL Azure Pipelines Agents are not detecting the Oracle JDK installation, and therefore not adding Java to system capabilities. We have set JAVA_HOME environment variable and added the directory to the path. The behaviour is a bit odd as when we SSH to the instance we can run java -version as the ado-agent user and it correctly gives the below output:

[ado-agent@ip-******]$ java -version
java version "21.0.3" 2024-04-16 LTS
Java(TM) SE Runtime Environment (build 21.0.3+7-LTS-152)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.3+7-LTS-152, mixed mode, sharing)

However, when we use a yaml pipeline to run the same command (and as the same user), it fails:

whoami: 
ado-agent
java -version:
/opt/ado-agent/_work/_temp/e45baab2-88de-4c50-92aa-4427d072d072.sh: line 5: java: command not found

Thanks

Versions

Azure DevOps Agent version: 3.248.0 / RHEL 8.10

Environment type (Please select at least one enviroment where you face this issue)

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Operation system

No response

Version controll system

No response

Azure DevOps Server Version (if applicable)

No response