Skip to content

Conversation

@sebersole
Copy link
Member

@sebersole sebersole commented Oct 24, 2025

Move from JDK 21 to JDK 25 for CI builds.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.


https://hibernate.atlassian.net/browse/HHH-19894

Copy link
Member

@yrodiere yrodiere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note you will also need to update the Jenkinsfile at the root of the repository:

  1. Update DEFAULT_JDK_VERSION, set it to 25.
  2. Add new BuildEnvironment( mainJdkVersion: '21', testJdkVersion: '21' ), just below the existing line for JDK 17.

@yrodiere
Copy link
Member

Also... you'll probably want to set this to 25, to require JDK 25 being used at build time?

orm.jdk.min=21

@hibernate-github-bot
Copy link

hibernate-github-bot bot commented Oct 24, 2025

Thanks for your pull request!

This pull request does not follow the contribution rules. Could you have a look?

❌ All commit messages should start with a JIRA issue key matching pattern HHH-\d+
    ↳ Offending commits: [0464bea, 6e08c5a, 600e956]

› This message was automatically generated.

@sebersole
Copy link
Member Author

Also... you'll probably want to set this to 25, to require JDK 25 being used at build time?

orm.jdk.min=21

Perhaps? Unfortunately it depends what task(s) you are running. If you run Javadoc, then yes this is true.

I'll change it and see what happens :D

@sebersole
Copy link
Member Author

Also... you'll probably want to set this to 25, to require JDK 25 being used at build time?

orm.jdk.min=21

Perhaps? Unfortunately it depends what task(s) you are running. If you run Javadoc, then yes this is true.

I'll change it and see what happens :D

The 3 Oracle jobs using Graalvm need Java 21 (or 23, but...). So we have 2 options that I see:

  1. Make the change you suggest, which I think is a good one. However, it requires the "hack" of running those 3 Oracle jobs with -Porm.jdk.min=21
  2. Keep orm.jdk.min=21 in the settings but add some specific pre-checks to Javadoc tasks that check > 23 is being used.

@marko-bekhta
Copy link
Member

or maybe

  1. Bump to GraalBM 25 ?

java-version: '21'

looks like it's available: https://github.com/graalvm/setup-graalvm?tab=readme-ov-file#options

@marko-bekhta
Copy link
Member

add some specific pre-checks to Javadoc tasks that check > 23 is being used

we should probably be more strict about the javadoc tool version...

  • from JDK to JDK the css changes so we need to apply a particular theme version (can be set dynamically based on the tool version. there are styles for 23 and 25)
  • parsing of config options depends on the generated layout, and that one aslo changes 😖

maybe we are lucky and the layout didn't change much and the parser would work just fine, but it's probably better to stay on the safe side 🫣 🙂

@yrodiere
Copy link
Member

Make the change you suggest, which I think is a good one. However, it requires the "hack" of running those 3 Oracle jobs with -Porm.jdk.min=21

That looks fine to me. AFAIK only the javadoc would be incorrect, and we don't need it in these jobs.

add some specific pre-checks to Javadoc tasks that check > 23 is being used

we should probably be more strict about the javadoc tool version...

Yeah no need to make our life harder. Require JDK 25 and be done with it?

or maybe

3. Bump to GraalBM 25 ?

If it's as simple as bumping the version, sure. If :)

@sebersole
Copy link
Member Author

or maybe

  1. Bump to GraalBM 25 ?

java-version: '21'

looks like it's available: https://github.com/graalvm/setup-graalvm?tab=readme-ov-file#options

Oh nice, that was not available last I knew. That would indeed be the best option

@sebersole
Copy link
Member Author

That worked like a champ! Good call @marko-bekhta

The s390x failure is because we test it using a number of JDKs...

new BuildEnvironment( mainJdkVersion: '17', testJdkVersion: '17' ),
new BuildEnvironment( mainJdkVersion: '21', testJdkVersion: '21' ),
new BuildEnvironment( testJdkVersion: '24', testJdkLauncherArgs: '--enable-preview', additionalOptions: '-PskipJacoco=true' ),
new BuildEnvironment( testJdkVersion: '25', testJdkLauncherArgs: '--enable-preview', additionalOptions: '-PskipJacoco=true' ),
new BuildEnvironment( testJdkVersion: '26', testJdkLauncherArgs: '--enable-preview -Dnet.bytebuddy.experimental=true', additionalOptions: '-PskipJacoco=true' )

We are going to need some changes here. IMO:

new BuildEnvironment( mainJdkVersion: '25', testJdkVersion: '17' ),
new BuildEnvironment( testJdkVersion: '25', testJdkLauncherArgs: '--enable-preview', additionalOptions: '-PskipJacoco=true' ),
new BuildEnvironment( testJdkVersion: '26', testJdkLauncherArgs: '--enable-preview -Dnet.bytebuddy.experimental=true', additionalOptions: '-PskipJacoco=true' )

// new BuildEnvironment( dbName: 'hana_cloud', dbLockableResource: 'hana-cloud', dbLockResourceAsHost: true ),
new BuildEnvironment( node: 's390x' ),
// We generally build with JDK 21, but our baseline is Java 17, so we test with JDK 17, to be sure everything works.
// Here we even compile the main code with JDK 17, to be sure no JDK 18+ classes are depended on.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder what's the history behind this and how bad it is to lose it... checking

Copy link
Member

@yrodiere yrodiere Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the reason: #hibernate-orm-dev > JDK builds @ 💬

TLDR: people will unknowningly using JDK 18+ APIs if we don't have a job that compiles the main code with JDK 17.

So I'd recommend something like this?

		// We generally build with JDK 25, but our baseline is Java 17, so we test with earlier JDKs, to be sure everything works.
		// We also compile the main code with JDK 17 once, to be sure no JDK 18+ classes are depended on.
		// See https://hibernate.zulipchat.com/#narrow/channel/132094-hibernate-orm-dev/topic/JDK.20builds/near/524436141
		new BuildEnvironment( mainJdkVersion: '17', testJdkVersion: '17', additionalOptions: 'something that skips javadoc' ),
		new BuildEnvironment( testJdkVersion: '21' ),

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the s390x bit aside, this is for the most part working.

As for this desire to run one job with mainJdkVersion=17, there are 2 "problems"...

  1. Each of these BuildEnvironments trigger running against H2. ci/build.sh always accounts for H2 using the problematic tasks. Your "something that skips javadoc" would need to get accounted for there. That's easy, but for completeness..
  2. Per our other conversation here, we changed the minimum JDK to be 25. Attempting to use a JDK earlier than 25 now results in an error. The hacky approach there would be to literally pass -Porm.jdk.min=17 for this one job. Coupled with the solution for (1), we aren't building the Javadoc so no harm, no foul.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Each of these BuildEnvironments trigger running against H2. ci/build.sh always accounts for H2 using the problematic tasks. Your "something that skips javadoc" would need to get accounted for there. That's easy, but for completeness..

In fact, for all of these H2 jobs from Jenkins we should always just skip javadoc generation. Stated more correctly, for these jobs from Jenkins we should treat them like the non-H2 jobs from GH workflow in terms of executing just ciCheck instead of ciCheck preVerifyRelease

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try to hack something but this Jenkinsfile syntax is bizarre to me :)

Comment on lines 5 to 11
# This is the default.
goal="preVerifyRelease"
# Settings needed for `preVerifyRelease` execution - for asciidoctor doc rendering
export GRADLE_OPTS=-Dorg.gradle.jvmargs='-Dlog4j2.disableJmx -Xmx4g -XX:MaxMetaspaceSize=768m -XX:+HeapDumpOnOutOfMemoryError -Duser.language=en -Duser.country=US -Duser.timezone=UTC -Dfile.encoding=UTF-8'
# - special check for Jenkins CI jobs where we don't want to run preVerifyRelease
if [[-n "$CI_SYSTEM" && "$CI_SYSTEM" != "jenkins"]]; then
goal="preVerifyRelease"
# Settings needed for `preVerifyRelease` execution - for asciidoctor doc rendering
export GRADLE_OPTS=-Dorg.gradle.jvmargs='-Dlog4j2.disableJmx -Xmx4g -XX:MaxMetaspaceSize=768m -XX:+HeapDumpOnOutOfMemoryError -Duser.language=en -Duser.country=US -Duser.timezone=UTC -Dfile.encoding=UTF-8'
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you wanted [[ -n "$CI_SYSTEM" || "$CI_SYSTEM" != "jenkins" ]]? (Note the space after [[, it's important)

Though this begs the question: shouldn't calling preVerifyRelease and adding these settings be the exception, e.g. added explicitly in one of the GH Actions jobs, while leaving the default to... whatever the default task is in our Gradle build?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand what you are asking, that's what happens - now (once this check is correct).

Previously, ci/build.sh would simply check for H2 and always trigger preVerifyRelease. However, we have a few CI jobs that use H2 -

  1. The Git Hub job
  2. These Jenkins JDK jobs

Previously, each of those would trigger preVerifyRelease because, again, ci/build.sh would simply check for H2.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was suggesting moving this out of this script and directly into the GH Actions script where it's needed. We can just call:

 export GRADLE_OPTS=-Dorg.gradle.jvmargs='-Dlog4j2.disableJmx -Xmx4g -XX:MaxMetaspaceSize=768m -XX:+HeapDumpOnOutOfMemoryError -Duser.language=en -Duser.country=US -Duser.timezone=UTC -Dfile.encoding=UTF-8
./ci/build.sh preVerifyRelease

Yes in practice that's the same -- except if calling build.sh locally.

@sebersole
Copy link
Member Author

I don't get these Jenkins jobs... The individual "builds" all show green, but the pipeline overview shows s390x build still failing. @beikov - thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants