Skip to content

Commit 2100cf5

Browse files
authored
[CI] Fix example-plugins tests by patching java home (elastic#138495)
Older version of openjdk17 are incompatible with newer ubuntu versions. On ubuntu24 we now replace openjdk17 with adoptopenjdk17 in these cases.
1 parent 923df9d commit 2100cf5

File tree

4 files changed

+26
-9
lines changed

4 files changed

+26
-9
lines changed

.buildkite/pipelines/periodic.template.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ steps:
3030

3131
- label: example-plugins
3232
command: |-
33-
cd $$WORKSPACE/plugins/examples
34-
35-
$$WORKSPACE/.ci/scripts/run-gradle.sh build
33+
./.ci/scripts/example-plugins.sh build
3634
timeout_in_minutes: 300
3735
agents:
3836
provider: gcp

.buildkite/pipelines/periodic.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -753,9 +753,7 @@ steps:
753753

754754
- label: example-plugins
755755
command: |-
756-
cd $$WORKSPACE/plugins/examples
757-
758-
$$WORKSPACE/.ci/scripts/run-gradle.sh build
756+
./.ci/scripts/example-plugins.sh build
759757
timeout_in_minutes: 300
760758
agents:
761759
provider: gcp

.buildkite/pipelines/pull-request/example-plugins.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ config:
77
steps:
88
- label: example-plugins
99
command: |-
10-
cd $$WORKSPACE/plugins/examples
11-
12-
$$WORKSPACE/.ci/scripts/run-gradle.sh -Dorg.gradle.jvmargs=-Xmx8g build --include-build $$WORKSPACE
10+
./.ci/scripts/example-plugins.sh -Dorg.gradle.jvmargs=-Xmx8g build --include-build $$WORKSPACE
1311
timeout_in_minutes: 300
1412
agents:
1513
provider: gcp

.ci/scripts/example-plugins.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
# Older versions of openjdk are incompatible to newer kernel of ubuntu. Use adoptopenjdk17 instead
6+
resolve_java_home() {
7+
if [[ "$ES_BUILD_JAVA" == *"openjdk17"* ]]; then
8+
if [ -f "/etc/os-release" ]; then
9+
. /etc/os-release
10+
if [[ "$ID" == "ubuntu" && "$VERSION_ID" == "24.04" ]]; then
11+
echo "$HOME/.java/adoptopenjdk17"
12+
return
13+
fi
14+
fi
15+
fi
16+
17+
echo "$JAVA_HOME"
18+
}
19+
20+
cd $WORKSPACE/plugins/examples
21+
22+
JAVA_HOME=$(resolve_java_home) \
23+
$WORKSPACE/.ci/scripts/run-gradle.sh $@

0 commit comments

Comments
 (0)