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

Fix version parsing script #4095

Merged
merged 5 commits into from
Mar 13, 2024
Merged

Fix version parsing script #4095

merged 5 commits into from
Mar 13, 2024

Conversation

Baltoli
Copy link
Collaborator

@Baltoli Baltoli commented Mar 13, 2024

This PR applies some minor cleanup to the checkJava script's parsing of java --version output. The new code will produce a correct error message for Java >= 11, and better handles slightly different formats of version data produced by different JVM implementations.

Fixes #4059
Fixes #4061

@@ -36,7 +36,7 @@ else
setarch
JAVA=$NG
else
version=$("$_java" -version 2>&1)
version=$("$_java" --version)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason, java --version prints to stdout and -version to stderr. The two-dash version appears to be the more consistent format as well.


# The Java version information we're parsing here looks something like this:
#
# openjdk 21.0.2 2024-01-16
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, java -version would - for some implementations - produce something like:

openjdk version "21.0.2" 2024-01-16

on the first line.

Copy link
Contributor

@gtrepta gtrepta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just one comment.

k-distribution/src/main/scripts/lib/checkJava Outdated Show resolved Hide resolved
@rv-jenkins rv-jenkins merged commit f51ca17 into develop Mar 13, 2024
8 checks passed
@rv-jenkins rv-jenkins deleted the fix-check-java branch March 13, 2024 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move checkJava logic into Java code Cannot install K on ubuntu-latest GitHub Actions runner
3 participants