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

Use bundled JDK in Sys V init #45593

Merged
merged 5 commits into from
Aug 15, 2019

Conversation

jasontedor
Copy link
Member

This commit addresses an issue when trying to using Elasticsearch on systems with Sys V init and the bundled JDK was not being used. Instead, we were still inadvertently trying to fallback on the path. This commit removes that fallback as that is against our intentions for 7.x where we only support the bundled JDK or an explicit JDK via JAVA_HOME.

Closes #45542

This commit addresses an issue when trying to using Elasticsearch on
systems with Sys V init and the bundled JDK was not being used. Instead,
we were still inadvertently trying to fallback on the path. This commit
removes that fallback as that is against our intentions for 7.x where we
only support the bundled JDK or an explicit JDK via JAVA_HOME.
@jasontedor jasontedor added >bug :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts v8.0.0 v7.4.0 v7.3.1 labels Aug 15, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

assumeThat(distribution().hasJdk, is(true));

final Result readlink = sh.run("readlink /usr/bin/java");
assertThat(readlink.exitCode, equalTo(0));
Copy link
Contributor

Choose a reason for hiding this comment

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

Shell.run already checks that exitCode is 0.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, I pushed 4581efe.

echo "Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME"
exit 1
fi
if [ ! -z "${JAVA_HOME}" ]; then
Copy link
Member

Choose a reason for hiding this comment

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

We don't seem to actually use JAVA here anywhere. Other than exporting JAVA_HOME, could we remove this logic and let bin/elasticsearch handle it?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll explore the consequences of this in a follow-up, I want to get this fix in for 7.3.1.

Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

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

LGTM

fi

if [ ! -x "$JAVA" ]; then
echo "Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME"
Copy link
Member

Choose a reason for hiding this comment

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

This error message is still referencing PATH

@jasontedor jasontedor merged commit 56cb10e into elastic:master Aug 15, 2019
jasontedor added a commit that referenced this pull request Aug 15, 2019
This commit addresses an issue when trying to using Elasticsearch on
systems with Sys V init and the bundled JDK was not being used. Instead,
we were still inadvertently trying to fallback on the path. This commit
removes that fallback as that is against our intentions for 7.x where we
only support the bundled JDK or an explicit JDK via JAVA_HOME.
jasontedor added a commit that referenced this pull request Aug 15, 2019
This commit addresses an issue when trying to using Elasticsearch on
systems with Sys V init and the bundled JDK was not being used. Instead,
we were still inadvertently trying to fallback on the path. This commit
removes that fallback as that is against our intentions for 7.x where we
only support the bundled JDK or an explicit JDK via JAVA_HOME.
@jasontedor jasontedor deleted the the-wicked-which-of-the-west branch August 15, 2019 20:18
@mark-vieira mark-vieira added the Team:Delivery Meta label for Delivery team label Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts Team:Delivery Meta label for Delivery team v7.3.1 v7.4.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Elasticsearch 7.2.* is not detecting its own JVM java binary on CentOS 6.* or Ubuntu Trusty 14.04
6 participants