Skip to content

Commit 5de7823

Browse files
lhotarimanas-ctds
authored andcommitted
[improve][build] Allow building and running tests on JDK 24 and upcoming JDK 25 LTS (apache#24268)
(cherry picked from commit 5e5bd14) (cherry picked from commit 01864fc)
1 parent 049eba6 commit 5de7823

File tree

4 files changed

+36
-8
lines changed

4 files changed

+36
-8
lines changed

.github/workflows/pulsar-ci-flaky.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ on:
4545
options:
4646
- '17'
4747
- '21'
48-
default: '17'
48+
- '24'
49+
- '25'
50+
default: '21'
4951
trace_test_resource_cleanup:
5052
description: 'Collect thread & heap information before exiting a test JVM. When set to "on", thread dump and heap histogram will be collected. When set to "full", a heap dump will also be collected.'
5153
required: true
@@ -96,13 +98,13 @@ jobs:
9698
- name: Select JDK major version
9799
id: jdk_major_version
98100
run: |
99-
# use JDK 21 for the scheduled build with cron expression '0 6 * * *'
101+
# use JDK 17 for the scheduled build with cron expression '0 6 * * *'
100102
if [[ "${{ github.event_name == 'schedule' && github.event.schedule == '0 6 * * *' && 'true' || 'false' }}" == "true" ]]; then
101-
echo "jdk_major_version=21" >> $GITHUB_OUTPUT
103+
echo "jdk_major_version=17" >> $GITHUB_OUTPUT
102104
exit 0
103105
fi
104-
# use JDK 17 for build unless overridden with workflow_dispatch input
105-
echo "jdk_major_version=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.jdk_major_version || '17'}}" >> $GITHUB_OUTPUT
106+
# use JDK 21 for build unless overridden with workflow_dispatch input
107+
echo "jdk_major_version=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.jdk_major_version || '21'}}" >> $GITHUB_OUTPUT
106108
107109
- name: checkout
108110
if: ${{ github.event_name == 'pull_request' }}

.github/workflows/pulsar-ci.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ on:
4545
options:
4646
- '17'
4747
- '21'
48+
- '24'
49+
- '25'
4850
default: '21'
4951
trace_test_resource_cleanup:
5052
description: 'Collect thread & heap information before exiting a test JVM. When set to "on", thread dump and heap histogram will be collected. When set to "full", a heap dump will also be collected.'
@@ -599,6 +601,13 @@ jobs:
599601
setup: ./build/run_integration_group.sh SHADE_BUILD
600602
no_coverage: true
601603

604+
- name: Shade on Java 24
605+
group: SHADE_RUN
606+
upload_name: SHADE_RUN_24
607+
runtime_jdk: 24
608+
setup: ./build/run_integration_group.sh SHADE_BUILD
609+
no_coverage: true
610+
602611
- name: Standalone
603612
group: STANDALONE
604613

docker/pulsar/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ RUN apk add --no-cache binutils
6161

6262
# Use JLink to create a slimmer JDK distribution (see: https://adoptium.net/blog/2021/10/jlink-to-produce-own-runtime/)
6363
# This still includes all JDK modules, though in the future we could compile a list of required modules
64-
RUN /usr/lib/jvm/default-jvm/bin/jlink --add-modules ALL-MODULE-PATH --compress=2 --no-man-pages --no-header-files --strip-debug --output /opt/jvm
64+
# first try with Java 17/21 compatible jlink command and if it fails, fallback to Java 24+ compatible command
65+
RUN /usr/lib/jvm/default-jvm/bin/jlink --add-modules ALL-MODULE-PATH --compress=2 --no-man-pages --no-header-files --strip-debug --output /opt/jvm || /usr/lib/jvm/default-jvm/bin/jlink --module-path /usr/lib/jvm/default-jvm/jmods --add-modules ALL-MODULE-PATH --compress=zip-9 --no-man-pages --no-header-files --strip-debug --output /opt/jvm
6566
RUN echo networkaddress.cache.ttl=1 >> /opt/jvm/conf/security/java.security
6667
RUN echo networkaddress.cache.negative.ttl=1 >> /opt/jvm/conf/security/java.security
6768

pom.xml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ flexible messaging model and an intuitive client API.</description>
115115
--add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED <!--MBeanStatsGenerator-->
116116
--add-opens java.base/jdk.internal.platform=ALL-UNNAMED <!--LinuxInfoUtils-->
117117
-XX:+EnableDynamicAgentLoading <!-- byte-buddy-agent and mockito-core agent dynamic loading -->
118+
${test.additional.args.jdk24}
118119
</test.additional.args>
120+
<test.additional.args.jdk24></test.additional.args.jdk24>
119121
<testMaxHeapSize>1300M</testMaxHeapSize>
120122
<testReuseFork>true</testReuseFork>
121123
<testForkCount>4</testForkCount>
@@ -2131,8 +2133,8 @@ flexible messaging model and an intuitive client API.</description>
21312133
<configuration>
21322134
<rules>
21332135
<requireJavaVersion>
2134-
<version>[17,18),[21,22)</version>
2135-
<message>Java 17 or Java 21 is required to build Pulsar.</message>
2136+
<version>[17,18),[21,22),[24,26)</version>
2137+
<message>Java 17, 21, 24 or 25 is required to build Pulsar.</message>
21362138
</requireJavaVersion>
21372139
<requireMavenVersion>
21382140
<version>3.6.1</version>
@@ -3055,6 +3057,20 @@ flexible messaging model and an intuitive client API.</description>
30553057
</distributionManagement>
30563058
</profile>
30573059

3060+
<profile>
3061+
<id>jdk24</id>
3062+
<activation>
3063+
<jdk>24</jdk>
3064+
</activation>
3065+
<properties>
3066+
<!-- JDK 24+ specific arguments -->
3067+
<test.additional.args.jdk24>
3068+
--enable-native-access=ALL-UNNAMED <!-- Required by java.lang.System::loadLibrary calls -->
3069+
--sun-misc-unsafe-memory-access=allow <!-- required for enabling unsafe memory access for Netty since 4.1.121.Final -->
3070+
</test.additional.args.jdk24>
3071+
</properties>
3072+
</profile>
3073+
30583074
</profiles>
30593075

30603076
<repositories>

0 commit comments

Comments
 (0)