From 6679ae7dab5dbd42e23fd2c0ab76c456981cd89a Mon Sep 17 00:00:00 2001 From: James Nord Date: Tue, 21 May 2024 17:17:23 +0100 Subject: [PATCH 1/3] modernize and attemopt to tidy deps --- pom.xml | 843 +++++++++++++----- .../release/maven/MavenReleaseWrapper.java | 2 +- 2 files changed, 610 insertions(+), 235 deletions(-) diff --git a/pom.xml b/pom.xml index 8e27b8c18..84a841ce1 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ org.jenkins-ci.plugins plugin - 3.57 + 4.82 artifactory @@ -32,11 +32,9 @@ https://github.com/jenkinsci/artifactory-plugin - - 2.263.1 - 8 - - true + + true + 2.426.3 true true @@ -104,113 +102,108 @@ + + + + io.jenkins.tools.bom + bom-2.426.x + 2555.v3190a_8a_c60c6 + pom + import + + + + + + + jakarta.annotation + jakarta.annotation-api + 2.1.1 + test + + + io.jenkins.plugins + commons-lang3-api + org.jenkins-ci.main maven-plugin - 3.4 + - commons-lang3 - org.apache.commons + org.apache.maven + maven-artifact + +--> + + javax.annotation + javax.annotation-api + + + commons-io + commons-io org.jenkins-ci.plugins junit - 1.29 org.jenkins-ci.plugins ssh-credentials - 1.18.1 org.jenkins-ci.plugins token-macro - 2.12 org.jenkins-ci.plugins apache-httpcomponents-client-4-api - 4.5.13-1.0 - - - - httpcore - org.apache.httpcomponents - - - httpclient - org.apache.httpcomponents - - org.jenkins-ci.plugins config-file-provider - 3.7.1 org.jenkins-ci.plugins subversion - 2.15.1 true - - - org.tmatesoft.svnkit - svnkit - - - org.tmatesoft.svnkit - svnkit - 1.10.4 + org.jenkins-ci.plugins + trilead-api org.jenkins-ci.plugins structs - 1.22 org.jenkins-ci.plugins git - 3.3.2 true - - - org.slf4j - slf4j-jdk14 - - org.jenkins-ci.plugins.workflow workflow-job - 2.32 - - - org.jenkins-ci.plugins - script-security - - org.jenkins-ci.plugins mailer - 1.34.2 org.jenkins-ci.plugins @@ -227,12 +220,10 @@ org.jenkins-ci.plugins matrix-project - 1.18.1 org.jenkins-ci.plugins ant - 1.2 org.jenkins-ci.plugins @@ -248,12 +239,10 @@ org.jenkins-ci.plugins credentials - 2.3.19 org.jenkins-ci.plugins plain-credentials - 1.3 org.jenkins-ci.plugins @@ -270,6 +259,38 @@ com.thoughtworks.xstream xstream + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.core + jackson-core + + + org.apache.commons + commons-lang3 + + + org.apache.httpcomponents + httpclient + + + com.google.guava + guava + + + commons-codec + commons-codec + + + commons-io + commons-io + @@ -281,6 +302,38 @@ com.thoughtworks.xstream xstream + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.core + jackson-core + + + org.apache.commons + commons-lang3 + + + org.apache.httpcomponents + httpclient + + + com.google.guava + guava + + + commons-codec + commons-codec + + + commons-io + commons-io + @@ -292,6 +345,34 @@ com.thoughtworks.xstream xstream + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.core + jackson-core + + + org.apache.commons + commons-lang3 + + + com.google.guava + guava + + + commons-codec + commons-codec + + + commons-io + commons-io + @@ -303,25 +384,40 @@ com.thoughtworks.xstream xstream + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.core + jackson-core + + + org.apache.commons + commons-lang3 + + + org.apache.httpcomponents + httpclient + + + com.google.guava + guava + + + commons-codec + commons-codec + + + commons-io + commons-io + - - org.jfrog.filespecs - file-specs-java - 1.1.1 - - - - com.jcraft - jzlib - 1.1.3 - - org.jfrog.buildinfo build-info-extractor-ivy @@ -335,9 +431,46 @@ groovy-all org.codehaus.groovy + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.core + jackson-core + + + org.apache.commons + commons-lang3 + + + org.apache.httpcomponents + httpclient + + + org.slf4j + slf4j-api + + + com.google.guava + guava + + + commons-codec + commons-codec + + + commons-io + commons-io + + org.eclipse.aether aether-impl 1.1.0 @@ -355,6 +488,62 @@ org.codehaus.plexus * + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.core + jackson-annotations + + + org.codehaus.groovy + jackson-core + + + com.fasterxml.jackson.core + groovy-all + + + org.apache.commons + commons-lang3 + + + org.codehaus.groovy + groovy-all + + + org.apache.maven + maven-repository-metadata + + + org.apache.maven + maven-model + + + org.apache.maven + maven-core + + + com.fasterxml.jackson.core + jackson-core + + + org.apache.httpcomponents + httpclient + + + com.google.guava + guava + + + commons-codec + commons-codec + + + commons-io + commons-io + @@ -390,67 +579,277 @@ com.tonicsystems.jarjar jarjar-plugin + + com.fasterxml.jackson.core + jackson-databind + + + com.github.spotbugs + spotbugs-annotations + + + org.apache.commons + commons-lang3 + + + org.apache.httpcomponents + httpclient + + + com.google.guava + guava + + + commons-io + commons-io + org.jfrog.buildinfo build-info-extractor-npm ${buildinfo.version} + + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.core + jackson-core + + + org.apache.commons + commons-lang3 + + + org.apache.httpcomponents + httpclient + + + org.slf4j + slf4j-api + + + org.slf4j + slf4j-simple + + + com.google.guava + guava + + + commons-codec + commons-codec + + + commons-io + commons-io + + org.jfrog.buildinfo build-info-extractor-go ${buildinfo.version} + + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.core + jackson-core + + + org.apache.commons + commons-lang3 + + + org.apache.httpcomponents + httpclient + + + com.google.guava + guava + + + commons-codec + commons-codec + + + commons-io + commons-io + + org.jfrog.buildinfo build-info-extractor-pip ${buildinfo.version} + + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.core + jackson-core + + + org.apache.commons + commons-lang3 + + + org.apache.httpcomponents + httpclient + + + org.slf4j + slf4j-simple + + + com.google.guava + guava + + + commons-codec + commons-codec + + + commons-io + commons-io + + org.jfrog.buildinfo build-info-extractor-docker ${buildinfo.version} + + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.core + jackson-core + + + org.apache.commons + commons-lang3 + + + org.glassfish.jersey.core + jersey-client + + + org.glassfish.jersey.connectors + jersey-apache-connector + + + org.glassfish.jersey.inject + jersey-hk2 + + + org.glassfish.jersey.core + jersey-common + + + org.apache.httpcomponents + httpclient + + + org.slf4j + slf4j-api + + + org.slf4j + slf4j-simple + + + org.slf4j + jcl-over-slf4j + + + com.google.guava + guava + + + commons-codec + commons-codec + + + commons-io + commons-io + + org.jfrog.buildinfo build-info-extractor-nuget ${buildinfo.version} + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.core + jackson-core + + + com.fasterxml.woodstox + woodstox-core + + + org.apache.commons + commons-lang3 + + + org.apache.httpcomponents + httpclient + + + com.google.guava + guava + + + commons-codec + commons-codec + + + commons-io + commons-io + + - commons-codec - commons-codec - 1.15 - - - commons-io - commons-io - 2.8.0 - - - - org.apache.commons - commons-compress - 1.21 - - - org.slf4j - jcl-over-slf4j - ${slf4jVersion} - compile - - - org.slf4j - slf4j-api - ${slf4jVersion} - compile - - - com.google.guava - guava - 18.0 - - + org.apache.ivy ivy 2.5.2 @@ -458,107 +857,51 @@ io.jenkins.plugins jersey2-api - 2.35-8 org.jenkins-ci.plugins jira - 3.0.14 + 3.12 true - - - org.jenkins-ci.plugins - branch-api - - - com.atlassian.jira - jira-rest-java-client-api - - - com.atlassian.jira - jira-rest-java-client-core - - - - - com.atlassian.jira - jira-rest-java-client-api - 5.2.5 - - - com.atlassian.jira - jira-rest-java-client-core - 5.2.5 org.jenkins-ci.plugins jenkins-multijob-plugin 1.13 - - - maven-plugin - org.jenkins-ci.main - - true org.jenkins-ci.plugins.workflow workflow-step-api - 2.22 org.jenkins-ci.plugins.workflow workflow-cps - 2.61.1 - - - org.jenkins-ci.plugins - script-security - - org.jenkins-ci.plugins.workflow workflow-multibranch - 2.23.1 true - - - org.jenkins-ci.plugins - script-security - - - - - org.codehaus.plexus - plexus-classworlds - 2.5.2 - compile - - - org.codehaus.groovy - groovy-all - 2.4.21 - provided org.jenkins-ci.plugins jackson2-api - 2.13.2.20220328-281.v9ecc7a_5e834f - + + + + + + - org.jenkins-ci.main - jenkins-test-harness - 2.44 + org.junit.jupiter + junit-jupiter-engine test - org.junit.jupiter - junit-jupiter-api - 5.8.2 + org.junit.vintage + junit-vintage-engine test @@ -577,6 +920,50 @@ commons-lang commons-lang + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.core + jackson-core + + + org.apache.commons + commons-lang3 + + + org.codehaus.groovy + groovy + + + org.apache.httpcomponents + httpclient + + + org.slf4j + slf4j-api + + + org.slf4j + jcl-over-slf4j + + + org.slf4j + log4j-over-slf4j + + + commons-codec + commons-codec + + + commons-io + commons-io + @@ -589,61 +976,74 @@ io.netty netty-handler + + javax.servlet + javax.servlet-api + + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.core + jackson-core + + + org.apache.commons + commons-lang3 + + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + + + org.apache.httpcomponents + httpclient + + + org.slf4j + slf4j-api + + + com.google.guava + guava + + + commons-codec + commons-codec + + + commons-io + commons-io + - - com.github.spotbugs - spotbugs - 4.5.3 - test - - - - - - org.bouncycastle - bcprov-jdk18on - 1.77 - - - org.bouncycastle - bcpkix-jdk18on - 1.77 - - - - org.apache.maven.plugins maven-javadoc-plugin - 2.10.3 - -Xdoclint:none - - - - maven-release-plugin - - deploy + none org.apache.maven.plugins maven-surefire-plugin - 2.22.1 true - **/InjectedTest.java **/*ITest.java @@ -652,7 +1052,6 @@ org.apache.maven.plugins maven-failsafe-plugin - 2.22.1 @@ -677,29 +1076,6 @@ - - org.apache.maven.plugins - maven-enforcer-plugin - - - - enforce - - - - - - - com.thoughtworks.xstream:xstream - org.slf4j:slf4j-jdk14:*:jar:compile - - - - true - - - - org.zeroturnaround jrebel-maven-plugin @@ -720,7 +1096,6 @@ com.github.spotbugs spotbugs-maven-plugin - 4.5.3.0 spotbugs-security-exclude.xml diff --git a/src/main/java/org/jfrog/hudson/release/maven/MavenReleaseWrapper.java b/src/main/java/org/jfrog/hudson/release/maven/MavenReleaseWrapper.java index 9d1740ca8..8e62b956d 100644 --- a/src/main/java/org/jfrog/hudson/release/maven/MavenReleaseWrapper.java +++ b/src/main/java/org/jfrog/hudson/release/maven/MavenReleaseWrapper.java @@ -66,7 +66,7 @@ public class MavenReleaseWrapper extends BuildWrapper { private boolean useReleaseBranch; private List mavenModules = new ArrayList(); - private final String POM_NAME = "pom.xml"; + private static final String POM_NAME = "pom.xml"; @DataBoundConstructor public MavenReleaseWrapper(String releaseBranchPrefix, String tagPrefix, String targetRemoteName, String alternativeGoals, From d286e81df3bcff000a34c83b439da41fc92ab7bb Mon Sep 17 00:00:00 2001 From: James Nord Date: Tue, 21 May 2024 18:00:40 +0100 Subject: [PATCH 2/3] re-enable injected test fix jelly files missing PI --- pom.xml | 2 -- src/main/resources/index.jelly | 1 + .../resources/org/jfrog/hudson/ArtifactoryBuilder/global.jelly | 1 + .../org/jfrog/hudson/ArtifactoryRedeployPublisher/config.jelly | 1 + .../org/jfrog/hudson/BuildInfoResultAction/summary.jelly | 1 + .../org/jfrog/hudson/XrayScanResultAction/summary.jelly | 1 + .../hudson/generic/ArtifactoryGenericConfigurator/config.jelly | 1 + .../hudson/gradle/ArtifactoryGradleConfigurator/config.jelly | 1 + .../jfrog/hudson/ivy/ArtifactoryIvyConfigurator/config.jelly | 1 + .../hudson/ivy/ArtifactoryIvyFreeStyleConfigurator/config.jelly | 1 + .../hudson/maven3/ArtifactoryMaven3Configurator/config.jelly | 1 + .../maven3/ArtifactoryMaven3NativeConfigurator/config.jelly | 1 + .../org/jfrog/hudson/maven3/Maven3Builder/config.jelly | 1 + .../pipeline/action/DeployedGradleArtifactsAction/index.jelly | 1 + .../pipeline/action/DeployedGradleArtifactsAction/summary.jelly | 1 + .../pipeline/action/DeployedMavenArtifactsAction/index.jelly | 1 + .../pipeline/action/DeployedMavenArtifactsAction/summary.jelly | 1 + .../org/jfrog/hudson/release/PromoteBuildAction/badge.jelly | 1 + .../org/jfrog/hudson/release/PromoteBuildAction/progress.jelly | 1 + .../jfrog/hudson/release/gradle/GradleReleaseAction/index.jelly | 1 + .../jfrog/hudson/release/maven/MavenReleaseAction/index.jelly | 1 + .../jfrog/hudson/release/maven/MavenReleaseWrapper/config.jelly | 1 + .../hudson/trigger/ArtifactoryMultibranchTrigger/config.jelly | 1 + .../org/jfrog/hudson/trigger/ArtifactoryTrigger/config.jelly | 1 + 24 files changed, 23 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 84a841ce1..1145999cc 100644 --- a/pom.xml +++ b/pom.xml @@ -32,8 +32,6 @@ https://github.com/jenkinsci/artifactory-plugin - - true 2.426.3 true diff --git a/src/main/resources/index.jelly b/src/main/resources/index.jelly index eb2a3843d..e1a821459 100644 --- a/src/main/resources/index.jelly +++ b/src/main/resources/index.jelly @@ -1,3 +1,4 @@ + diff --git a/src/main/resources/org/jfrog/hudson/ivy/ArtifactoryIvyConfigurator/config.jelly b/src/main/resources/org/jfrog/hudson/ivy/ArtifactoryIvyConfigurator/config.jelly index 9afb0cbe5..a7e8ecfe6 100644 --- a/src/main/resources/org/jfrog/hudson/ivy/ArtifactoryIvyConfigurator/config.jelly +++ b/src/main/resources/org/jfrog/hudson/ivy/ArtifactoryIvyConfigurator/config.jelly @@ -1,3 +1,4 @@ + diff --git a/src/main/resources/org/jfrog/hudson/ivy/ArtifactoryIvyFreeStyleConfigurator/config.jelly b/src/main/resources/org/jfrog/hudson/ivy/ArtifactoryIvyFreeStyleConfigurator/config.jelly index f625f0a96..dc9fb8a25 100644 --- a/src/main/resources/org/jfrog/hudson/ivy/ArtifactoryIvyFreeStyleConfigurator/config.jelly +++ b/src/main/resources/org/jfrog/hudson/ivy/ArtifactoryIvyFreeStyleConfigurator/config.jelly @@ -1,3 +1,4 @@ + + diff --git a/src/main/resources/org/jfrog/hudson/release/maven/MavenReleaseWrapper/config.jelly b/src/main/resources/org/jfrog/hudson/release/maven/MavenReleaseWrapper/config.jelly index f1d977164..5daaac8c9 100644 --- a/src/main/resources/org/jfrog/hudson/release/maven/MavenReleaseWrapper/config.jelly +++ b/src/main/resources/org/jfrog/hudson/release/maven/MavenReleaseWrapper/config.jelly @@ -1,4 +1,5 @@ + diff --git a/src/main/resources/org/jfrog/hudson/trigger/ArtifactoryTrigger/config.jelly b/src/main/resources/org/jfrog/hudson/trigger/ArtifactoryTrigger/config.jelly index e46a0f852..fbf772876 100644 --- a/src/main/resources/org/jfrog/hudson/trigger/ArtifactoryTrigger/config.jelly +++ b/src/main/resources/org/jfrog/hudson/trigger/ArtifactoryTrigger/config.jelly @@ -1,3 +1,4 @@ + From 8d5851c97c872d1e973f2cc84440eb892729d51f Mon Sep 17 00:00:00 2001 From: James Nord Date: Tue, 21 May 2024 18:00:52 +0100 Subject: [PATCH 3/3] fix dependency bounds and related compilation issue. the plugin would have previously just blown up at runtime if a new p4 plugin was used as the APIs called did not exist. The plugin may still blow up at runtime, however there is at least more possibility that it will indeed not blow up --- pom.xml | 2 +- .../release/scm/perforce/P4Manager.java | 29 ++++++++++--------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/pom.xml b/pom.xml index 1145999cc..1724156d1 100644 --- a/pom.xml +++ b/pom.xml @@ -206,7 +206,7 @@ org.jenkins-ci.plugins p4 - 1.3.8 + 1.15.1 true diff --git a/src/main/java/org/jfrog/hudson/release/scm/perforce/P4Manager.java b/src/main/java/org/jfrog/hudson/release/scm/perforce/P4Manager.java index f7dd90042..c0c954c8f 100644 --- a/src/main/java/org/jfrog/hudson/release/scm/perforce/P4Manager.java +++ b/src/main/java/org/jfrog/hudson/release/scm/perforce/P4Manager.java @@ -4,12 +4,16 @@ import com.perforce.p4java.server.IOptionsServer; import hudson.EnvVars; import hudson.model.AbstractBuild; +import hudson.model.Item; import hudson.model.TaskListener; +import hudson.scm.SCM; + import org.apache.commons.lang3.StringUtils; import org.jenkinsci.plugins.p4.PerforceScm; import org.jenkinsci.plugins.p4.client.ClientHelper; import org.jenkinsci.plugins.p4.client.ConnectionFactory; import org.jenkinsci.plugins.p4.client.ConnectionHelper; +import org.jenkinsci.plugins.p4.workspace.Workspace; import org.jfrog.build.vcs.perforce.PerforceClient; import java.nio.charset.StandardCharsets; @@ -36,12 +40,12 @@ public void prepare() { PerforceScm perforceScm = getJenkinsScm(); String credentials = perforceScm.getCredential(); - ConnectionHelper connection = new ConnectionHelper(credentials, buildListener); - IOptionsServer server = ConnectionFactory.getConnection(); try { - String clientString = getClientString(); - if (connection.isClient(clientString)) { - ClientHelper perforceClient = new ClientHelper(credentials, buildListener, clientString, StandardCharsets.UTF_8.toString()); + ConnectionHelper connection = new ConnectionHelper(build, credentials, buildListener); + IOptionsServer server = ConnectionFactory.getConnection(); + Workspace clientString = getClientWorkspace(); + if (connection.isClient(clientString.getName())) { + ClientHelper perforceClient = new ClientHelper((Item)this.build.getProject(), credentials, buildListener, clientString); IClient client = perforceClient.getClient(); try { this.perforce = new PerforceClient(server, client); @@ -64,14 +68,13 @@ public PerforceClient establishConnection() throws Exception { return this.perforce; } - private String getClientString() { - String client = StringUtils.EMPTY; - try { - EnvVars envVars = build.getEnvironment(buildListener); - client = envVars.get("P4_CLIENT"); - } catch (Exception e) { - logger.log(Level.FINE, "P4: Unable to read P4_CLIENT"); + private Workspace getClientWorkspace() { + SCM scm = this.build.getProject().getScm(); + if (scm instanceof PerforceScm) { + PerforceScm p4scm = (PerforceScm)scm; + return p4scm.getWorkspace(); } - return client; + logger.log(Level.FINE, "Unable to determine P4 workspace"); + return null; } }