Skip to content

Commit a963caf

Browse files
kibanamachinejbudz
andauthored
[9.1] [ci] Move java paths (#229894) (#231724)
# Backport This will backport the following commits from `main` to `9.1`: - [[ci] Move java paths (#229894)](#229894) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Jon","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-08-14T01:14:32Z","message":"[ci] Move java paths (#229894)\n\nInstead of manually managing various java versions, this moves to\nreferencing apt managed installations.\n\nThese are currently used for bazel and building elasticsearch.\n\nTested at\nhttps://buildkite.com/elastic/kibana-elasticsearch-snapshot-build/builds/6526","sha":"5245f408a88467a3486488357685b183d02565d8","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Operations","release_note:skip","skip-ci","backport:all-open","v9.2.0"],"title":"[ci] Move java paths","number":229894,"url":"https://github.com/elastic/kibana/pull/229894","mergeCommit":{"message":"[ci] Move java paths (#229894)\n\nInstead of manually managing various java versions, this moves to\nreferencing apt managed installations.\n\nThese are currently used for bazel and building elasticsearch.\n\nTested at\nhttps://buildkite.com/elastic/kibana-elasticsearch-snapshot-build/builds/6526","sha":"5245f408a88467a3486488357685b183d02565d8"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/229894","number":229894,"mergeCommit":{"message":"[ci] Move java paths (#229894)\n\nInstead of manually managing various java versions, this moves to\nreferencing apt managed installations.\n\nThese are currently used for bazel and building elasticsearch.\n\nTested at\nhttps://buildkite.com/elastic/kibana-elasticsearch-snapshot-build/builds/6526","sha":"5245f408a88467a3486488357685b183d02565d8"}}]}] BACKPORT--> Co-authored-by: Jon <[email protected]>
1 parent 62f1b22 commit a963caf

File tree

1 file changed

+12
-4
lines changed
  • .buildkite/scripts/steps/es_snapshots

1 file changed

+12
-4
lines changed

.buildkite/scripts/steps/es_snapshots/build.sh

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,19 @@ export BUILD_URL=""
3535
export JOB_NAME=""
3636
export NODE_NAME=""
3737

38-
# Reads the ES_BUILD_JAVA env var out of .ci/java-versions.properties and exports it
39-
export "$(grep '^ES_BUILD_JAVA' .ci/java-versions.properties | xargs)"
38+
export JAVA_VERSION="$(grep '^ES_BUILD_JAVA' .ci/java-versions.properties | sed 's/ES_BUILD_JAVA=openjdk//')"
39+
if [[ -z "$JAVA_VERSION" ]]; then
40+
echo "No ES_BUILD_JAVA version found."
41+
exit 1
42+
fi
43+
44+
export JAVA_HOME=$(update-alternatives --list java | grep "java-$JAVA_VERSION-openjdk" | sed 's#/bin/java$##')
45+
if [[ -z "$JAVA_HOME" ]]; then
46+
echo "No compatible JDK found. Ensure openjdk-$JAVA_VERSION is installed."
47+
exit 1
48+
fi
4049

41-
export PATH="$HOME/.java/$ES_BUILD_JAVA/bin:$PATH"
42-
export JAVA_HOME="$HOME/.java/$ES_BUILD_JAVA"
50+
export PATH="$JAVA_HOME/bin:$PATH"
4351
export DOCKER_BUILDKIT=1
4452

4553
# The Elasticsearch Dockerfile needs to be built with root privileges, but Docker on our servers is running using a non-root user

0 commit comments

Comments
 (0)