Azure-pipelines-agent: java capability not detected properly with Azul Zulu

Created on 10 Jan 2019  路  12Comments  路  Source: microsoft/azure-pipelines-agent

Agent Version and Platform

Version of your agent? 2.144.0/2.144.1/...

2.136.1

If on-premises, which release? 2015.0, 2017.1, 2019 RC2, etc.

2018 Update 3

OS of the machine running the agent? Windows

What's not working?

Very similar to #2045 the TFS agent isn't finding an installation of the Zulu JDK.

The registry details are only being set in:

Software\JavaSoft\Java Development Kit\8.0.192

ABTT Cross Platform no-stale

Most helpful comment

What's the status of this bug please? We've had several customers complaining that our SonarQube/SonarCloud extensions don't work correctly on their self-hosted Windows agents because they use a non-Oracle version of Java. We've pointed them to the manual workaround described in this thread, but I think it's fair to say they aren't happy about having to implement workarounds when setting up their self-hosted agents, particularly for a bug that is six months old.

All 12 comments

@madhurig

Same problem with me - agent does not detects Zulu JDK with latest https://github.com/Microsoft/azure-pipelines-image-generation/blob/aa536b6cdfac6b11f800b5f433820188275fa1c6/images/win/scripts/Installers/Install-JavaTools.ps1
In my situation, there is no JavaSoft key in registry at all, so https://github.com/Microsoft/azure-pipelines-agent/blob/c113d89607308107d663e3ff288be88faa66ec6b/src/Misc/layoutbin/powershell/Add-JavaCapabilities.ps1 will not advertise "Java" capability of agent.

It was spoiled by this change - https://github.com/Microsoft/azure-pipelines-image-generation/commit/38149278762aa6c7cc680e6ac6eeb6dd43c74169#diff-1f3c664485c5a6a60e79cead3612414f - when ant and maven have been installed without dependencies (as dependency was a JDK, which added correct registry records, while actually executed Java is from Zulu JDK)

The change on Microsoft/azure-pipelines-image-generation is the right fix, since we don't want to install Orcale JDKs on the hosted VMs. We are looking into the right way to detect Java capabilities on the agent but the recommended way is to set variables on the agent similar to the hosted VMs: https://github.com/Microsoft/azure-pipelines-image-generation/blob/38149278762aa6c7cc680e6ac6eeb6dd43c74169/images/win/scripts/Installers/Install-JavaTools.ps1#L51

So, I shall use setx java $latestJava8Install /M in my script? This would be enough to advertise that agent have Java installed?

I can confirm, that using setx java $latestJava8Install /M will make agent to see java capabilities

What's the status of this bug please? We've had several customers complaining that our SonarQube/SonarCloud extensions don't work correctly on their self-hosted Windows agents because they use a non-Oracle version of Java. We've pointed them to the manual workaround described in this thread, but I think it's fair to say they aren't happy about having to implement workarounds when setting up their self-hosted agents, particularly for a bug that is six months old.

Can confirm. I just tried a new install of Azure DevOps Server 2019 Update 1. Search failure on check.

C:\Users\Administrator>java --version
openjdk 11.0.4 2019-07-16 LTS
OpenJDK Runtime Environment Zulu11.33+15-CA (build 11.0.4+11-LTS)
OpenJDK 64-Bit Server VM Zulu11.33+15-CA (build 11.0.4+11-LTS, mixed mode)

Relevant part of Detailed Notes:

Java: 
    IsJavaInstalled: True
    IsServerVersion: True
    Is64BitVersion: True
    JavaHome: C:\Program Files\Zulu\zulu-11\
    JavaVersion: 11.0.4

[Info @11:44:55.380] Settings are not valid.

@TingluoHuang @madhurig

Hi there,

could you please inform us on the status of this issue? In our organisation, we also have this issue with the OpenJDK installations on our onprem agent servers.

This issue has had no activity in 180 days. Please comment if it is not actually stale

Has this issue been fixed? Thanks.

I just wanted to add that this is not just Zulu that this occurs with but Open JDK as well, just in case you are wondering .... :)

Reopening this since it still seems to be actual
Zulu JDK adds path to the bin folder to the PATH environment variable - maybe we could just check if java is runnable during capability detection - as it is currently for linux/OSX in line.

Was this page helpful?
0 / 5 - 0 ratings