Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Self hosted agents does not detect java capability for OpenJDK #3624

Open
groogiam opened this issue Nov 23, 2021 · 18 comments
Open

Self hosted agents does not detect java capability for OpenJDK #3624

groogiam opened this issue Nov 23, 2021 · 18 comments

Comments

@groogiam
Copy link

Agent Version and Platform

2.193.1

OS of the machine running the agent? OSX/Windows/Linux/...
Windows

Azure DevOps Type and Version

dev.azure.com

If dev.azure.com, what is your organization name?
https://dev.azure.com/flairsoft

What's not working?

The build agent does not seem to detect "java" capability for OpenJDK installations. This is described in #3402 and the last comment references this as fixed. The issue does not appear to be fixed as of 2.193.1 java is still not detected when OpenJDK is installed.

@EzzhevNikita
Copy link
Contributor

Hey, @groogiam, the agent is using register keys for detecting java capabilities. Are you sure that AdoptJDK added an entry into the register? Currently, the agent checks the set of register keys described in this file.

@groogiam
Copy link
Author

@EzzhevNikita I usually install OpenJDK with choco https://community.chocolatey.org/packages/openjdk which I'm guessing does not create these keys. I there a reason that the logic has opted to check for registry keys rather than java being on the path or a JAVA_HOME environment variables? Seems like this might be a more robust way of checking for a java environment. Thanks for your help and quick response.

@EzzhevNikita
Copy link
Contributor

@groogiam The main reason why we are using reg keys is that they are machine-specific, while env variables could change from user to user. And generally, registry keys are a more common and robust way to look for the installed programs on the machine.

@groogiam
Copy link
Author

@EzzhevNikita This example seems to point to the contrary. I'm still failing to see why env variables are not the best option here. Yes they can be different from user to user but they would either be set system wide or on the account the agent service is running as. In either case the mechanism seems like it would work. I'm curious how this check is done on a linux agent. Seems like there might be an opportunity here to make this check more consistent across both linux and windows.

@github-actions
Copy link

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

@github-actions github-actions bot added the stale label May 23, 2022
@groogiam
Copy link
Author

@EzzhevNikita Any update on how this check is done on linux?

@github-actions github-actions bot removed the stale label May 23, 2022
@Dylan-Prins
Copy link

How can nobody comment on this?

@sumit84mca
Copy link

@github-actions
Copy link

github-actions bot commented Dec 5, 2022

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

@github-actions github-actions bot added the stale label Dec 5, 2022
@groogiam
Copy link
Author

groogiam commented Dec 5, 2022

Can someone please provide some details on how this check is performed on Linux and why it can't be performed in a similar way on Windows?

@github-actions github-actions bot removed the stale label Dec 5, 2022
@github-actions
Copy link

github-actions bot commented Jun 3, 2023

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

@github-actions github-actions bot added the stale label Jun 3, 2023
@groogiam
Copy link
Author

groogiam commented Jun 6, 2023

Can someone please provide some details on how this check is performed on Linux and why it can't be performed in a similar way on Windows?

@github-actions github-actions bot removed the stale label Jun 6, 2023
Copy link

github-actions bot commented Dec 3, 2023

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

@github-actions github-actions bot added the stale label Dec 3, 2023
@groogiam
Copy link
Author

groogiam commented Dec 4, 2023

Can someone please provide some details on how this check is performed on Linux and why it can't be performed in a similar way on Windows?

@github-actions github-actions bot removed the stale label Dec 4, 2023
@ofgirichardsonb
Copy link

Agreed. Chocolatey is a common method of installing required system binaries. If the check on Linux doesn't require registry keys, then why can the Windows one not do the same check? This seems like an arbitrary restriction that is not adequately addressed by the JDK tool installer.

@ofgirichardsonb
Copy link

I see that this issue is now over 2 years old, and Microsoft is clearly just going to let it mothball. Regardless of what happens, I will have to do additional maintenance work and/or build a Linux build server to get this going, and I won't pursue it any further than this last comment. Frankly, it's not a good look to leave issues to die, especially when there are only 113 issues in the list. Perhaps the reason is that it's not a particularly defensible position to close as "WONTFIX"?

@sicil1ano
Copy link

I am having a similar problem detecting the Temurin JDK installed in a self-hosted agent running Linux.
I am using the exact same image used by Microsoft for their hosted agents to run an Ubuntu 22.04 agent (https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml and https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) and JAVA_HOME environment variables are not appearing.

I think the reason why those environment variables are not appearing is that Temurin JDK is not supported.
Please see this for details: https://github.com/actions/runner-images/blob/main/images/ubuntu/scripts/build/install-java-tools.sh

@rdebath
Copy link

rdebath commented Aug 7, 2024

To answer the badbot message the Unix versions of the agent don't bother to detect anything. Instead a bodge script copies a few of the env variables of user who installs the script into a file $Agent_HomeDirectory/.env. The contents of that file are added to the real environment of the Agent on startup just like $Agent_HomeDirectory/.capabilities.

I guess the best, sort of, solution is to bodge it the same way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants