-
Notifications
You must be signed in to change notification settings - Fork 88
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
install.sh: introduce Java existance check #401
base: master
Are you sure you want to change the base?
Conversation
This is part of scylladb/scylladb#17969, need to merge first. |
scripts/select-java
Outdated
done | ||
} | ||
|
||
# So far, scylla-jmx only works with Java 11 and Java 8, we prefer the newer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might want to s/scylla-jmx/scylla-tools/ . probably we could be more specific though, like "tools like nodetool and cassandra-stress". but "scylla-tools" is the name used by https://github.com/scylladb/scylla-tools-java?tab=readme-ov-file#scylla-tools .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, in scylla-jmx, select-java
actually serves for use cases
- if we are not installing the package, it selects the java executable at runtime, see https://github.com/scylladb/scylla-jmx/blob/3328a229610daac8198a4133b496a9d7cb1de469/scripts/scylla-jmx#L134 .
- if we are installing the package using
install.sh
,install.sh
is responsible for detecting the runtime environment for the java applications. so it also checks for the available java runtimes.
in this change, we only address the second use case, where we are installing scylla-tools using install.sh
, but what about the first use case? please note, the existing check is performed by
java_ver_output=`"${JAVA:-java}" -version 2>&1` |
java
fulfills the needs, it does not pick a java runtime. so if user actually has openjdk-11 installed, but he/she doe not point /usr/bin/java
to it, or export $JAVA
so that it points to one of the supported java runtime, cassandra.in.sh
fails.
Since we dropped Java check from unified installer and jmx, we need to do it on scylla-tools. Related scylladb/scylladb#17969
38fd305
to
5281c88
Compare
We need some code to detect Java on scylla-tools's install.sh, since we are dropping it from unified installer. |
fi | ||
|
||
if ! builtin command -v $JAVA > /dev/null; then | ||
echo "Please install openjdk-11 before running install.sh." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if user installs, for instance, openjdk-21 and have it in $PATH
? and we are not checking for openjdk-11, but a random java
executable in the $PATH
. so even if this test passes, it does not imply that we have openjdk-11 around.
Since we dropped Java check from unified installer and jmx, we need to do it on scylla-tools.
Related scylladb/scylladb#17969