- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 3.7k
 
Java 25 for CI builds #11155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Java 25 for CI builds #11155
Conversation
There was a problem hiding this 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:
- Update 
DEFAULT_JDK_VERSION, set it to25. - Add 
new BuildEnvironment( mainJdkVersion: '21', testJdkVersion: '21' ),just below the existing line for JDK 17. 
| 
           Also... you'll probably want to set this to 25, to require JDK 25 being used at build time? hibernate-orm/gradle.properties Line 30 in a406357 
  | 
    
          
 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: 
  | 
    
| 
           or maybe 
 hibernate-orm/.github/workflows/ci.yml Line 168 in 70ea3d3 
 looks like it's available: https://github.com/graalvm/setup-graalvm?tab=readme-ov-file#options  | 
    
          
 we should probably be more strict about the javadoc tool version... 
 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 🫣 🙂  | 
    
          
 That looks fine to me. AFAIK only the javadoc would be incorrect, and we don't need it in these jobs. 
 Yeah no need to make our life harder. Require JDK 25 and be done with it? 
 If it's as simple as bumping the version, sure. If :)  | 
    
          
 Oh nice, that was not available last I knew. That would indeed be the best option  | 
    
| 
           That worked like a champ! Good call @marko-bekhta The s390x failure is because we test it using a number of JDKs... We are going to need some changes here. IMO:  | 
    
| // 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. | 
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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' ),
There was a problem hiding this comment.
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"...
- Each of these BuildEnvironments trigger running against H2.  
ci/build.shalways 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.. - 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=17for this one job. Coupled with the solution for (1), we aren't building the Javadoc so no harm, no foul. 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Each of these BuildEnvironments trigger running against H2.
 ci/build.shalways 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
There was a problem hiding this comment.
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 :)
| # 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 | 
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 -
- The Git Hub job
 - These Jenkins JDK jobs
 
Previously, each of those would trigger preVerifyRelease because, again, ci/build.sh would simply check for H2.
There was a problem hiding this comment.
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.
| 
           I don't get these Jenkins jobs... The individual "builds" all show green, but the pipeline overview shows s390x build still failing. @beikov - thoughts?  | 
    
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