Add package pre-install check for java binary#31343
Conversation
The package installation relies on java being in the path. If java is not in the path, the tests fail at post-install time. This commit adds a pre-install check to validate that java exists, and if it fails, the package is never installed, and thus keeps a system clean, rather than aborting at post-install and leaving behind a mess. Closes elastic#29665
|
Pinging @elastic/es-core-infra |
jasontedor
left a comment
There was a problem hiding this comment.
Looks great; I left one question. Thanks for picking this up.
| JAVA=`which java` | ||
| fi | ||
|
|
||
| if [ ! -x "$JAVA" ]; then |
There was a problem hiding this comment.
Does this ever execute in a failing case? I think that these scripts are always executed with set +e or does it differ by packaging system? If we get here it's because $JAVA_HOME/bin/java exists which we set JAVA to, or which java failed and we should have exited?
There was a problem hiding this comment.
yea i copied this from https://github.com/elastic/elasticsearch/blob/master/distribution/packages/src/deb/init.d/elasticsearch#L83-L94 , and i think the logic is wrong. Ill fix up.
There was a problem hiding this comment.
Changed the bash test check to see if $JAVA is set.
| fi | ||
|
|
||
| if [ ! -x "$JAVA" ]; then | ||
| echo "Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME" |
There was a problem hiding this comment.
If this block is needed we have could not find java; set JAVA_HOME or ensure java is in PATH in elasticsearch-env. Maybe we can be consistent?
| move_java | ||
| run dpkg -i elasticsearch-oss-$(cat version).deb | ||
| output=$status | ||
| unmove_java |
| move_java | ||
| run rpm -i elasticsearch-oss-$(cat version).rpm | ||
| output=$status | ||
| unmove_java |
|
ping @jasontedor as I have fixed the check up. |
* elastic/master: (92 commits) Reduce number of raw types warnings (elastic#31523) Migrate scripted metric aggregation scripts to ScriptContext design (elastic#30111) turn GetFieldMappingsResponse to ToXContentObject (elastic#31544) Close xcontent parsers (partial) (elastic#31513) Ingest Attachment: Upgrade Tika to 1.18 (elastic#31252) TEST: Correct the assertion arguments order (elastic#31540) Add get field mappings to High Level REST API Client (elastic#31423) [DOCS] Updates Watcher examples for code testing (elastic#31152) TEST: Add bwc recovery tests with synced-flush index [DOCS] Move sql to docs (elastic#31474) [DOCS] Move monitoring to docs folder (elastic#31477) Core: Combine doExecute methods in TransportAction (elastic#31517) IndexShard should not return null stats (elastic#31528) fix repository update with the same settings but different type (elastic#31458) Fix Mockito trying to mock IOException that isn't thrown by method (elastic#31433) (elastic#31527) Node selector per client rather than per request (elastic#31471) Core: Combine messageRecieved methods in TransportRequestHandler (elastic#31519) Upgrade to Lucene 7.4.0. (elastic#31529) [ML] Add ML filter update API (elastic#31437) Allow multiple unicast host providers (elastic#31509) ...
The package installation relies on java being in the path. If java is not in the path, the tests fail at post-install time. This commit adds a pre-install check to validate that java exists, and if it fails, the package is never installed, and thus keeps a system clean, rather than aborting at post-install and leaving behind a mess. Closes #29665
The package installation relies on java being in the path. If java is not in the path, the tests fail at post-install time. This commit adds a pre-install check to validate that java exists, and if it fails, the package is never installed, and thus keeps a system clean, rather than aborting at post-install and leaving behind a mess. Closes #29665
* 6.x: Fix broken backport of #31578 by adjusting constructor (#31587) ingest: Add ignore_missing property to foreach filter (#22147) (#31578) Add package pre-install check for java binary (#31343) Docs: Clarify sensitive fields watcher encryption (#31551) Watcher: Remove never executed code (#31135) Improve test times for tests using `RandomObjects::addFields` (#31556) Revert "Remove RestGetAllAliasesAction (#31308)" REST high-level client: add simulate pipeline API (#31158) Get Mapping API to honour allow_no_indices and ignore_unavailable (#31507) Fix Mockito trying to mock IOException that isn't thrown by method (#31433) (#31527) [Test] Add full cluster restart test for Rollup (#31533) Enhance thread context uniqueness assertion fix writeIndex evaluation for aliases (#31562) Add x-opaque-id to search slow logs (#31539) Watcher: Fix put watch action (#31524) [DOCS] Significantly improve SQL docs turn GetFieldMappingsResponse to ToXContentObject (#31544) TEST: Unmute testHistoryUUIDIsGenerated Ingest Attachment: Upgrade Tika to 1.18 (#31252) TEST: Correct the assertion arguments order (#31540)
* master: ingest: Add ignore_missing property to foreach filter (#22147) (#31578) Fix a formatting issue in the docvalue_fields documentation. (#31563) reduce log level at gradle configuration time [TEST] Close additional clients created while running yaml tests (#31575) Docs: Clarify sensitive fields watcher encryption (#31551) Watcher: Remove never executed code (#31135) Add support for switching distribution for all integration tests (#30874) Improve robustness of geo shape parser for malformed shapes (#31449) QA: Create xpack yaml features (#31403) Improve test times for tests using `RandomObjects::addFields` (#31556) [Test] Add full cluster restart test for Rollup (#31533) Enhance thread context uniqueness assertion [DOCS] Fix heading format errors (#31483) fix writeIndex evaluation for aliases (#31562) Add x-opaque-id to search slow logs (#31539) Watcher: Fix put watch action (#31524) Add package pre-install check for java binary (#31343) Reduce number of raw types warnings (#31523) Migrate scripted metric aggregation scripts to ScriptContext design (#30111) turn GetFieldMappingsResponse to ToXContentObject (#31544) Close xcontent parsers (partial) (#31513) Ingest Attachment: Upgrade Tika to 1.18 (#31252) TEST: Correct the assertion arguments order (#31540)
This recreates a test that was added to the bats packaging tests in elastic#31343 but didn't make it over to the java project during when the linux package tests were ported in elastic#31943 When packages are installed but can not locate the java executable, they should fail with a descriptive message
This recreates a test that was added to the bats packaging tests in elastic#31343 but didn't make it over to the java project during when the linux package tests were ported in elastic#31943 When packages are installed but can not locate the java executable, they should fail with a descriptive message
The package installation relies on java being in the path. If java is
not in the path, the tests fail at post-install time. This commit adds a
pre-install check to validate that java exists, and if it fails, the
package is never installed, and thus keeps a system clean, rather than
aborting at post-install and leaving behind a mess.
Closes #29665