From c3726088df3f80c7953a599b43435fe0ad40dc8d Mon Sep 17 00:00:00 2001 From: Mark Waite Date: Thu, 10 Oct 2024 08:12:59 -0600 Subject: [PATCH] Require Jenkins 2.479 or newer (#1172) * Test JGit 7.0.0-m2 pre-release with Java 17 build JGit 7.0.0 requires Java 17. Jenkins 2.463 requires Java 17. Use the plugin bill of materials from 2.462.x because it is the closest we have to 2.463. The plugin is expected to work with any release 2.463 or later. * Test JGit 7.0.0 with Jakarta EE 9 Jenkins core * Use JGit 7.0.0.202408202050-m3 pre-release * Use JGit 7.0.0.202409031743-r * Adapt to removed API's in JGit 7.0.0 * Use test harness 2265.x * Next Jenkins baseline will be a .1 * Use JGit 7.0.0 with Java 17 JGit 7.0.0 requires Java 17. Jenkins 2.463 requires Java 17. Use the plugin bill of materials from 2.462.x because it is the closest we have to 2.463. The plugin is expected to work with any release 2.463 or later. Adapt to removed API's in JGit 7.0.0 by replacing calls to removed API's with the recommended equivalents. Tested in my development environment and no issues detected. Tests run from a container based Jenkins controller with Windows, Linux, and FreeBSD agents. Tests ran on multiple weekly releases of Jenkins since 2.463. The Linux agents include: * Alpine * Debian Linux 11, 12, testing, and unstable * openSUSE * Red Hat Enterprise Linux 8 * Rocky Linux 9 * Ubuntu 20.04, 22.04, and 24.04 * Use 6.1.0 as version * Use Java 17 features in source code https://docs.openrewrite.org/running-recipes/popular-recipe-guides/migrate-to-java-17 provided the transformations and they all pass automated tests. Several nice readability improvements are provided by Java 17. * Require Jenkins 2.477 * Use test harness that drops EE 8 * Use Jenkins test harness 2289.x * Use test harness 2299.* * Use parent pom 5.0 Removes a few of the workarounds since it is released. * Security scan not ready for Java 17 and Jakarta EE 9 * Use parent pom 5.1 https://github.com/jenkinsci/plugin-pom/releases/tag/plugin-5.1 notes that it includes a workaround the outdated ASM API inclusion that Guice brings into Jenkins core. Has not affected the git client plugin, but it is good to remain current with the most recent release of the parent pom. * Revert "Security scan not ready for Java 17 and Jakarta EE 9" Cheeck if security scan is ready for Java 17 and Jakarta EE 9 This reverts commit 4bcca7ec8193cc4c1867c89d224743a5a7332e68. * Use StaplerRequest2 for EE 9 No need to rely on the compatibility layer for EE 8 --------- Co-authored-by: git-client-user --- pom.xml | 8 +++----- src/main/java/hudson/plugins/git/GitTool.java | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index cd43aac52c..088e0839ef 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.jenkins-ci.plugins plugin - 4.88 + 5.1 @@ -53,7 +53,7 @@ - 6.0.1 + 6.1.0 -SNAPSHOT -Dfile.encoding=${project.build.sourceEncoding} @@ -62,10 +62,8 @@ 2.462 - 2.463 + 2.479 7.0.0.202409031743-r - - 17 Max Low false diff --git a/src/main/java/hudson/plugins/git/GitTool.java b/src/main/java/hudson/plugins/git/GitTool.java index d88ff75df3..23004b2809 100644 --- a/src/main/java/hudson/plugins/git/GitTool.java +++ b/src/main/java/hudson/plugins/git/GitTool.java @@ -27,7 +27,7 @@ import org.jenkinsci.Symbol; import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.QueryParameter; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; import org.kohsuke.stapler.interceptor.RequirePOST; /** @@ -153,7 +153,7 @@ public String getDisplayName() { } @Override - public boolean configure(StaplerRequest req, JSONObject json) { + public boolean configure(StaplerRequest2 req, JSONObject json) { setInstallations(req.bindJSONToList(clazz, json.get("tool")).toArray(new GitTool[0])); save(); return true;