Upgrade GoCD to run and build with Java 17#9818
Merged
chadlwilson merged 11 commits intogocd:masterfrom Feb 5, 2022
Merged
Conversation
37bd1f0 to
1b8b802
Compare
4 tasks
This was referenced Oct 31, 2021
ad41c4f to
3a91c7d
Compare
chadlwilson
added a commit
to gocd-contrib/gocd-oss-cookbooks
that referenced
this pull request
Nov 2, 2021
…upport JDKs. Supports work on JDK 17 compatibility gocd/gocd#9818
c199f17 to
cb1c606
Compare
c21d4b0 to
2be5ef1
Compare
c19d019 to
102f86f
Compare
61a5a9f to
5f97d78
Compare
chadlwilson
added a commit
to gocd/developer.go.cd
that referenced
this pull request
Jan 30, 2022
- Anticipates the merge of gocd/gocd#9818 which has more details - fixes some typos - updates the requirements per current server
…nloading Adoptium/Eclipse Temurin builds Adoptium now publish validated Alpine Linux builds of Eclipse Temurin JVM, compiled directly against musl libc (rather than glibc). Using these would avoid the need to use the Alpine GLIBC package which is not recommended by the Alpine team, and which is no longer supported by Adopt in their own containers. See the long discussion at adoptium/containers#1 At time of writing we cannot move away from glibc because the Tanuki wrapper does not seem to work against musl, OR with either gcompat or libc6-compat compatibility layers (both seem to be missing some symbols). However this allows us to do so in future by changing the targetted `OperatingSystem` in the alpine and docker-dind `Distro`s
…le JVM to vary, using Java 17 for compile+test JVM - Gradle 6.x does not support Java 17; but we want to target it which toolchains allow us to do https://docs.gradle.org/current/userguide/toolchains.html - In future this also allows us to use later Java version for Gradle, and earlier version for release if necessary - source and target compatibility flags are not considered the best way to target JVM releases now using javac, the `release` flag is, which ensures the boot classpath is correct to avoid unintended usages of newer APIs: https://docs.gradle.org/current/userguide/building_java_projects.html#sec:java_cross_compilation - Prevent auto-download of JVMs specified by toolchains. Ensure that user has control; and avoid mysteriously slow builds on build.gocd.org by failing fast. Requires `gocddev` build images `3.1.4`+ for JDK 17 onwards.
…(they are relevant config fields annotated etc as such) Since many of our config classes extend `java.util` collections, they have many fields (static and otherwise) for which `setAccessible` will fail be default on Java 16/17 where the Java internals are closed by default. While we will likely still need to `--add-opens` for these in order to do deep cloning of config using the `Cloner`s, it adds a lot more clarity to have these errors occur in the right places; when cloning config, rather than during initial bootstrap of config. This will also allow us to add more optimized cloners for these classes in some locations which might avoid needing to deep clone inside Java internals (`ArrayList`s, `HashMap`s etc) entirely.
- Illegal reflective access is denied by default on JDK 16, and JDK 17 requires specific add-opens (you cannot permit illegal access globally). - Java 17 enforces https://openjdk.java.net/jeps/403 which strongly encapsulates internals per gocd#9469 - We appear to depend on a lot of such reflection due to use of the Cloning/Cloner library and some internal to Hibernate 3.6 - These were just discovered through running automated tests, plus starting server and clicking around various functions and looking at what breaks where. - There are possibly some others, however this seemed sufficient to pass all the tests and some adhoc usage Defined the required opens alongside the installers; which is where they mainly need to live. We also, unfortunately, need these when running server-based tests - an attempt is made here to include or exclude them based on whether the tests are for agent or server code, although this isn't easily to discover, so by default we consider modules to run on the server, and only classify agents which seem to require less opened modules - they also are needed for Rails RSpec tests which start a server - Also workaround issue with use of selenium-webdriver 3.142.17 and childprocess on JRuby with Java 17. It's dying on Windows with `illegal access getting field 'private final java.io.FileDescriptor sun.nio.ch.FileChannelImpl.fd' : class org.jruby.java.invokers.InstanceFieldGetter cannot access class sun.nio.ch.FileChannelImpl (in module java.base) because module java.base does not export sun.nio.ch to unnamed module 2f465398` Let's try following the warning and see how far we go. The Jasmine Gem is going to wrap Node Jasmine soon-enough, so this will probably become moot.
Reduce the amount of memory it uses at minimum and decrease the number of test classes run per fork.
There appears to be issues with use of Groovy-generated dynamic proxies for interfaces (with default methods) on Groovy 3.0.9. This workaround opens access to the module system, so that we can then open access to the dynamic proxies. Intend to follow up with Grolifant folks as well as Groovy folks after a bit more clarity on possible backport, at https://issues.apache.org/jira/browse/GROOVY-10145
…use of Grolifant and DownloaderTask.groovy on Java 17 There appears to be issues with use of Groovy-generated dynamic proxies for interfaces (with default methods) on Groovy 3.0.9. This workaround opens access to the module system, so that we can then open access to the dynamic proxies. Intend to follow up with Grolifant folks as well as Groovy folks after a bit more clarity on possible backport, at https://issues.apache.org/jira/browse/GROOVY-10145 This currently needs to be addressed since we have custom scripting to download Selenium Drivers for Chrome and Firefox for use in (some) UI tests. May want to evaluate pre-existing automation to handle this later.
Member
Author
|
All is clear now; failing build is due to remove the BUILD_ON_JDK=17 being removed for merge (forgot to pause the PR build) |
Member
Author
|
Workaround guide at #10265 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #9635, #9469
--add-opensto open up internal JVM modules for reflection, that seems to be required in a number of places, including use of the deep objectcloner(but not limited to this) and Hibernate 3.6/javassistsource/targetcompatibility, preferring thereleaseflag which ensures code doesn't depend on APIs from earlier JVMs it shouldn't.Task list
--add-opensargs so the tests foragentrun with different set of args thanserversince they seem to require different packages to be open--add-opens. The current list was derived through trial and error.setAccessiblereflection stuff throughout the codeSvnCommandand such exception handling which sets exception internals. Is this used on agents?smudgeExceptioncode is only used when checking modifications on the server, it appears. So should be fine.--add-openswhen running certain tests inside IDEBefore merge
build.gocd.orgtoBUILD_ON_JDK=17Plugin testing / sanity checks
More testing
21.2.0with22.1.0agents+bootstrapper (agent auto-downgrades)Unable to make field private java.lang.String java.util.regex.Pattern.pattern accessible: module java.base does not "opens java.util.regex" to unnamed moduleandUnable to make field private transient java.util.NavigableMap java.util.TreeSet.m accessible: module java.base does not "opens java.util" to unnamed module @51565ec2. Should be OK with21.4.0as the serialization was fixed.wrapper-config/wrapper.conf- setset.default.AGENT_STARTUP_ARGS=-Xms128m -Xmx256m --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.regex=ALL-UNNAMED21.2.022.1.0with21.2.0agents+bootstrapper (agent auto-upgrades OK)22.1.0