Skip to content

Commit 5e5bd14

Browse files
authored
[improve][build] Allow building and running tests on JDK 24 and upcoming JDK 25 LTS (#24268)
1 parent 86857ae commit 5e5bd14

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
@@ -44,7 +44,9 @@ on:
4444
options:
4545
- '17'
4646
- '21'
47-
default: '17'
47+
- '24'
48+
- '25'
49+
default: '21'
4850
trace_test_resource_cleanup:
4951
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.'
5052
required: true
@@ -95,13 +97,13 @@ jobs:
9597
- name: Select JDK major version
9698
id: jdk_major_version
9799
run: |
98-
# use JDK 21 for the scheduled build with cron expression '0 6 * * *'
100+
# use JDK 17 for the scheduled build with cron expression '0 6 * * *'
99101
if [[ "${{ github.event_name == 'schedule' && github.event.schedule == '0 6 * * *' && 'true' || 'false' }}" == "true" ]]; then
100-
echo "jdk_major_version=21" >> $GITHUB_OUTPUT
102+
echo "jdk_major_version=17" >> $GITHUB_OUTPUT
101103
exit 0
102104
fi
103-
# use JDK 17 for build unless overridden with workflow_dispatch input
104-
echo "jdk_major_version=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.jdk_major_version || '17'}}" >> $GITHUB_OUTPUT
105+
# use JDK 21 for build unless overridden with workflow_dispatch input
106+
echo "jdk_major_version=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.jdk_major_version || '21'}}" >> $GITHUB_OUTPUT
105107
106108
- name: checkout
107109
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
@@ -44,6 +44,8 @@ on:
4444
options:
4545
- '17'
4646
- '21'
47+
- '24'
48+
- '25'
4749
default: '21'
4850
trace_test_resource_cleanup:
4951
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.'
@@ -598,6 +600,13 @@ jobs:
598600
setup: ./build/run_integration_group.sh SHADE_BUILD
599601
no_coverage: true
600602

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

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>
@@ -2923,6 +2925,20 @@ flexible messaging model and an intuitive client API.</description>
29232925
</properties>
29242926
</profile>
29252927

2928+
<profile>
2929+
<id>jdk24</id>
2930+
<activation>
2931+
<jdk>24</jdk>
2932+
</activation>
2933+
<properties>
2934+
<!-- JDK 24+ specific arguments -->
2935+
<test.additional.args.jdk24>
2936+
--enable-native-access=ALL-UNNAMED <!-- Required by java.lang.System::loadLibrary calls -->
2937+
--sun-misc-unsafe-memory-access=allow <!-- required for enabling unsafe memory access for Netty since 4.1.121.Final -->
2938+
</test.additional.args.jdk24>
2939+
</properties>
2940+
</profile>
2941+
29262942
</profiles>
29272943

29282944
<repositories>

0 commit comments

Comments
 (0)