Skip to content
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

7.17/JDK23 REPRODUCE WITH lines aren't working for me #114099

Closed
DaveCTurner opened this issue Oct 4, 2024 · 3 comments
Closed

7.17/JDK23 REPRODUCE WITH lines aren't working for me #114099

DaveCTurner opened this issue Oct 4, 2024 · 3 comments
Labels
>bug :Delivery/Build Build or test infrastructure Team:Delivery Meta label for Delivery team

Comments

@DaveCTurner
Copy link
Contributor

E.g. investigating #114089, the REPRODUCE WITH line is as follows:

./gradlew ':plugins:discovery-ec2:test' --tests "org.elasticsearch.discovery.ec2.Ec2DiscoveryTests.testPublicIp" -Dtests.seed=67E5E30A1DC80CD3 -Dtests.locale=ne -Dtests.timezone=America/Virgin -Druntime.java=23

When I run this I get an error (build scan):

FAILURE: Build failed with an exception.    
* Where:    
Build file '/Users/davidturner/src/elasticsearch-7.17/build.gradle' line: 49    
* What went wrong:  
An exception occurred applying plugin request [id: 'elasticsearch.global-build-info']   
> Failed to apply plugin 'elasticsearch.global-build-info'. 
   > Environment variable 'JAVA23_HOME' is not registered with Gradle installation supplier. Ensure 'org.gradle.java.installations.fromEnv' is updated in gradle.properties file.   

So I added JAVA23_HOME as it suggests, even though there's no mention of JAVA22_HOME so I suspect this isn't the exact right fix:

diff --git a/gradle.properties b/gradle.properties
index cac081293fd5..623f0ff7569a 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -17,7 +17,7 @@ systemProp.jdk.tls.client.protocols=TLSv1.2

 # java homes resolved by environment variables
 org.gradle.java.installations.auto-detect=false
-org.gradle.java.installations.fromEnv=JAVA_HOME,RUNTIME_JAVA_HOME,JAVA21_HOME,JAVA20_HOME,JAVA19_HOME,JAVA18_HOME,JAVA17_HOME,JAVA16_HOME,JAVA15_HOME,JAVA14_HOME,JAVA13_HOME,JAVA12_HOME,JAVA11_HOME,JAVA8_HOME
+org.gradle.java.installations.fromEnv=JAVA_HOME,RUNTIME_JAVA_HOME,JAVA23_HOME,JAVA21_HOME,JAVA20_HOME,JAVA19_HOME,JAVA18_HOME,JAVA17_HOME,JAVA16_HOME,JAVA15_HOME,JAVA14_HOME,JAVA13_HOME,JAVA12_HOME,JAVA11_HOME,JAVA8_HOME

 # log some dependency verification info to console
 org.gradle.dependency.verification.console=verbose

Now I get a load of errors about the new-to-JDK23 this-escape and lossy-conversions warnings (build scan 1, build scan 2).

Not sure what's different between my dev environment and CI, because CI seems to be handling this ok. Any ideas?

@DaveCTurner DaveCTurner added :Delivery/Build Build or test infrastructure >bug labels Oct 4, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-delivery (Team:Delivery)

@elasticsearchmachine elasticsearchmachine added the Team:Delivery Meta label for Delivery team label Oct 4, 2024
@mark-vieira
Copy link
Contributor

Now I get a load of errors about the new-to-JDK23 this-escape and lossy-conversions warnings (build scan 1, build scan 2).

This is actually unrelated to the runtime Java version and instead the compiler. These warnings go away when using Java 17 as the compiler version, which is what we use in CI. We've sorted out these issues in 8.x but looks like they haven't backported them to 7.17.

Not sure what's different between my dev environment and CI, because CI seems to be handling this ok. Any ideas?

The difference is that CI sets RUNTIME_JAVA_HOME rather than the runtime.java system property.

This worked for me locally, but probably because I already have Java 23 cached locally by another branch. If you try running with -Druntime.java=23 on main then switch back to 7.17 does it then work? Keep in mind you need to use Java 17 for the build.

There's likely some JDK provisioning logic that hasn't been backported here which would explain the difference in behavior. It likely hasn't been backported for a reason, which is that 8.x and 7.17 have sufficiently diverged to make these backports kind of a pain. If my described workaround works for you we'll likely close this given 7.17 going away with the 9.0 release.

@DaveCTurner
Copy link
Contributor Author

Ok yeah JAVA_HOME=${JAVA17_HOME} RUNTIME_JAVA_HOME=${JAVA23_HOME} ./gradlew ':plugins:discovery-ec2:test' --tests "org.elasticsearch.discovery.ec2.Ec2DiscoveryTests.testPublicIp" -Dtests.seed=67E5E30A1DC80CD3 -Dtests.locale=ne -Dtests.timezone=America/Virgin (NB leading env vars) works for me:

=======================================
Elasticsearch Build Hamster says Hello!
  Gradle Version        : 8.10.2
  OS Info               : Mac OS X 15.0.1 (aarch64)
  Runtime JDK Version   : 23+37 (Eclipse Temurin, 23+37)
  Runtime java.home     : /Users/davidturner/jvms/jdk-23+37/Contents/Home
  Gradle JDK Version    : 17.0.7+7 (Eclipse Temurin)
  Gradle java.home      : /Users/davidturner/jvms/jdk-17.0.7+7/Contents/Home
  Random Testing Seed   : 67E5E30A1DC80CD3
  In FIPS 140 mode      : false
=======================================

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Delivery/Build Build or test infrastructure Team:Delivery Meta label for Delivery team
Projects
None yet
Development

No branches or pull requests

3 participants