From b0814d5b14078bf16c168d0362ba1d4d7fc9d425 Mon Sep 17 00:00:00 2001 From: Bryan Stopp Date: Mon, 10 Jun 2024 13:02:22 -0400 Subject: [PATCH] chore: Update Dependencies (#91) * Support tests when git requires signed commits. * Bring deps up to date * Fix spot bugs issues. --- pom.xml | 142 ++++++------------ .../action/PipelineWaitingAction.java | 5 +- .../cloudmanager/config/AdobeIOConfig.java | 2 + .../cloudmanager/util/DescriptorHelper.java | 5 +- .../cloudmanager/webhook/CMEventPayload.java | 2 + .../builder/RepositorySyncBuilderTest.java | 15 +- .../AdobeIOProjectConfigIntegrationTest.java | 7 +- .../step/PipelineStepStateStepTest.java | 4 +- 8 files changed, 74 insertions(+), 108 deletions(-) diff --git a/pom.xml b/pom.xml index ff330c9..053fe0f 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.jenkins-ci.plugins plugin - 4.19 + 4.83 io.jenkins.plugins @@ -15,11 +15,13 @@ hpi + 11 + 999999-SNAPSHOT - 2.277.3 - 8 + 2.426.3 jenkinsci/${project.artifactId}-plugin - 2.0 + + 44.0 Low Max @@ -37,17 +39,7 @@ Adobe Inc - - - - io.jenkins.tools.bom - bom-2.249.x - 872.v03c18fa35487 - import - pom - - - + @@ -69,8 +61,8 @@ - scm:git:git://github.com/${gitHubRepo}.git - scm:git:git@github.com:${gitHubRepo}.git + scm:git://github.com/${gitHubRepo}.git + scm:git@github.com:${gitHubRepo}.git https://github.com/${gitHubRepo} ${scmTag} @@ -94,69 +86,64 @@ + + + + io.jenkins.tools.bom + bom-2.426.x + 3105.v672692894683 + import + pom + + + + + commons-io + commons-io + 2.16.1 + + + org.slf4j + slf4j-api + 2.0.13 + + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + 1.9.10 + + + + io.adobe.cloudmanager aio-lib-cloudmanager 1.0.0 - java8 org.projectlombok lombok - 1.18.20 + 1.18.32 provided - - - org.apache.commons - commons-lang3 - 3.12.0 - - - org.slf4j - slf4j-api - 1.7.30 - - - commons-io - commons-io - 2.10.0 - - - org.jenkins-ci.plugins - credentials - - - org.jenkins-ci.plugins - plain-credentials - + org.jenkins-ci.plugins git org.jenkins-ci.plugins - git-client - 3.7.2 - - - org.jenkins-ci.plugins.workflow - workflow-step-api - - - org.jenkins-ci.plugins - apache-httpcomponents-client-4-api + scm-api org.jenkins-ci.plugins.workflow workflow-job - - junit - junit - test + org.jenkins-ci.plugins.workflow + workflow-step-api io.jenkins @@ -189,7 +176,7 @@ org.jenkins-ci.plugins.workflow workflow-aggregator - 2.6 + 596.v8c21c963d92d test @@ -198,12 +185,6 @@ tests test - - org.jenkins-ci.plugins.workflow - workflow-step-api - tests - test - org.jenkins-ci.plugins.workflow workflow-cps @@ -214,39 +195,6 @@ workflow-durable-task-step test - - - - com.fasterxml.jackson.core - jackson-core - ${jackson.version} - test - - - com.fasterxml.jackson.core - jackson-annotations - ${jackson.version} - test - - - com.fasterxml.jackson.core - jackson-databind - ${jackson.version} - test - - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - ${jackson.version} - test - - - com.fasterxml.jackson.module - jackson-module-jaxb-annotations - ${jackson.version} - test - - org.jmockit jmockit diff --git a/src/main/java/io/jenkins/plugins/adobe/cloudmanager/action/PipelineWaitingAction.java b/src/main/java/io/jenkins/plugins/adobe/cloudmanager/action/PipelineWaitingAction.java index e527736..1478f4f 100644 --- a/src/main/java/io/jenkins/plugins/adobe/cloudmanager/action/PipelineWaitingAction.java +++ b/src/main/java/io/jenkins/plugins/adobe/cloudmanager/action/PipelineWaitingAction.java @@ -63,8 +63,9 @@ public class PipelineWaitingAction implements RunAction2, Serializable { private static final Logger LOGGER = LoggerFactory.getLogger(PipelineWaitingAction.class); private static final long serialVersionUID = 1L; - @SuppressFBWarnings(value = "SE_TRANSIENT_FIELD_NOT_RESTORED", justification = "Reloaded during onLoad(Run)") + @SuppressFBWarnings(value = "SE_TRANSIENT_FIELD_NOT_RESTORED", justification = "Reloaded during onAttached/onLoad(Run)") private transient List executions = new ArrayList<>(); + @SuppressFBWarnings(value = "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", justification = "Reloaded during onAttached/onLoad(Run)") private transient Run run; private List ids = new CopyOnWriteArrayList<>(); @@ -165,7 +166,7 @@ public PipelineStepStateExecution getDynamic(String id) throws InterruptedExcept return getExecution(id); } - // Load all of the executions. Be careful with the logic here, can sometimes block the VM thread - don't want that. + // Load all the executions. Be careful with the logic here, can sometimes block the VM thread - don't want that. private synchronized void loadExecutions() throws InterruptedException, TimeoutException { if (executions == null) { // Loaded after restart. try { diff --git a/src/main/java/io/jenkins/plugins/adobe/cloudmanager/config/AdobeIOConfig.java b/src/main/java/io/jenkins/plugins/adobe/cloudmanager/config/AdobeIOConfig.java index c63ead5..4f271b0 100644 --- a/src/main/java/io/jenkins/plugins/adobe/cloudmanager/config/AdobeIOConfig.java +++ b/src/main/java/io/jenkins/plugins/adobe/cloudmanager/config/AdobeIOConfig.java @@ -34,6 +34,7 @@ import org.apache.commons.lang3.StringUtils; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import hudson.Extension; import io.jenkins.plugins.adobe.cloudmanager.webhook.CloudManagerWebHook; import jenkins.model.GlobalConfiguration; @@ -59,6 +60,7 @@ public class AdobeIOConfig extends GlobalConfiguration { // Webhook is disabled by default - make a conscious decision to enable it. private boolean webhookEnabled = false; + @SuppressFBWarnings("MC_OVERRIDABLE_METHOD_CALL_IN_CONSTRUCTOR") public AdobeIOConfig() { getConfigFile().getXStream().alias("adobe-io-project-config", AdobeIOProjectConfig.class); load(); diff --git a/src/main/java/io/jenkins/plugins/adobe/cloudmanager/util/DescriptorHelper.java b/src/main/java/io/jenkins/plugins/adobe/cloudmanager/util/DescriptorHelper.java index 4717d10..4f6a700 100644 --- a/src/main/java/io/jenkins/plugins/adobe/cloudmanager/util/DescriptorHelper.java +++ b/src/main/java/io/jenkins/plugins/adobe/cloudmanager/util/DescriptorHelper.java @@ -56,7 +56,10 @@ public static ListBoxModel fillAioProjectItems() { lbm.add(Messages.DescriptorHelper_defaultListItem(), ""); AdobeIOConfig aio = AdobeIOConfig.configuration(); for (AdobeIOProjectConfig cfg : aio.getProjectConfigs()) { - lbm.add(cfg.getDisplayName(), cfg.getName()); + String name = cfg.getName(); + if (name != null) { + lbm.add(cfg.getDisplayName(), name); + } } return lbm; } diff --git a/src/main/java/io/jenkins/plugins/adobe/cloudmanager/webhook/CMEventPayload.java b/src/main/java/io/jenkins/plugins/adobe/cloudmanager/webhook/CMEventPayload.java index 5f1d0ff..3ad5ac7 100644 --- a/src/main/java/io/jenkins/plugins/adobe/cloudmanager/webhook/CMEventPayload.java +++ b/src/main/java/io/jenkins/plugins/adobe/cloudmanager/webhook/CMEventPayload.java @@ -43,6 +43,7 @@ import org.apache.commons.lang3.StringUtils; import org.apache.http.entity.ContentType; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import io.adobe.cloudmanager.CloudManagerApiException; import io.adobe.cloudmanager.event.CloudManagerEvent; import io.adobe.cloudmanager.event.CloudManagerEvent.EventType; @@ -68,6 +69,7 @@ /** * Annotation Handler for processing the payload. */ + @SuppressFBWarnings("DCN_NULLPOINTER_EXCEPTION") // See note. class PayloadHandler extends AnnotationHandler { private static final Logger LOGGER = LoggerFactory.getLogger(CMEventPayload.PayloadHandler.class); diff --git a/src/test/java/io/jenkins/plugins/adobe/cloudmanager/builder/RepositorySyncBuilderTest.java b/src/test/java/io/jenkins/plugins/adobe/cloudmanager/builder/RepositorySyncBuilderTest.java index 8165748..4989718 100644 --- a/src/test/java/io/jenkins/plugins/adobe/cloudmanager/builder/RepositorySyncBuilderTest.java +++ b/src/test/java/io/jenkins/plugins/adobe/cloudmanager/builder/RepositorySyncBuilderTest.java @@ -94,9 +94,12 @@ public static void beforeClass() throws Exception { @Before public void before() throws Exception { + srcRepo.git("init"); + srcRepo.git("config", "--local", "commit.gpgsign", "false"); srcRepo.init(); srcRepo.git("checkout", "-b", defaultBranch); bareDestRepo.git("init", "--bare"); + bareDestRepo.git("config", "--local", "commit.gpgsign", "false"); bareDestRepo.git("symbolic-ref", "HEAD", "refs/heads/" + defaultBranch); CredentialsStore store = CredentialsProvider.lookupStores(rule.jenkins).iterator().next(); @@ -161,6 +164,7 @@ public void conflictNoForce() throws Exception { destRepo.git("clone", bareDestRepo.toString(), "."); destRepo.git("checkout", "-b", defaultBranch); + destRepo.git("config", "--local", "commit.gpgsign", "false"); destRepo.git("config", "user.name", "Git SampleRepoRule"); destRepo.git("config", "user.email", "gits@mplereporule"); destRepo.write("testfile", "testfilecontents"); @@ -193,6 +197,7 @@ public void conflictWithForce() throws Exception { destRepo.git("clone", bareDestRepo.toString(), "."); destRepo.git("checkout", "-b", defaultBranch); + destRepo.git("config", "--local", "commit.gpgsign", "false"); destRepo.git("config", "user.name", "Git SampleRepoRule"); destRepo.git("config", "user.email", "gits@mplereporule"); destRepo.write("testfile", "testfilecontents"); @@ -227,6 +232,7 @@ public void missingTargetBranch() throws Exception { srcRepo.git("commit", "--message=file"); destRepo.git("clone", bareDestRepo.toString(), "."); + destRepo.git("config", "--local", "commit.gpgsign", "false"); destRepo.git("config", "user.name", "Git SampleRepoRule"); destRepo.git("config", "user.email", "gits@mplereporule"); destRepo.write("testfile", "testfilecontents"); @@ -255,6 +261,8 @@ public void missingTargetBranch() throws Exception { @Test public void multipleScmsWarning() throws Exception { + destRepo.git("init"); + destRepo.git("config", "--local", "commit.gpgsign", "false"); destRepo.init(); WorkflowJob job = rule.jenkins.createProject(WorkflowJob.class, "test"); @@ -333,6 +341,7 @@ public void pipelineSuccess() throws Exception { public void pipelineCredentialed() throws Exception { Server server = new Server(); ServerConnector connector = new ServerConnector(server); + connector.setHost("127.0.0.1"); server.addConnector(connector); ServletContextHandler handler = new ServletContextHandler(ServletContextHandler.NO_SESSIONS); handler.setContextPath("/*"); @@ -342,11 +351,11 @@ public void pipelineCredentialed() throws Exception { server.start(); String host = connector.getHost() == null ? "localhost" : connector.getHost(); - String repoUrl = "http://" + host + ":" + connector.getLocalPort() + "/repo"; + String repoUrl = "http://127.0.0.1:" + connector.getLocalPort() + "/repo"; - String pipeline = "" + + String pipeline = "pipeline {\n" + - " agent { label 'master' }\n" + + " agent any\n" + " stages {\n" + " stage('sync') {\n" + " steps {\n" + diff --git a/src/test/java/io/jenkins/plugins/adobe/cloudmanager/config/AdobeIOProjectConfigIntegrationTest.java b/src/test/java/io/jenkins/plugins/adobe/cloudmanager/config/AdobeIOProjectConfigIntegrationTest.java index 3b37cc1..295e719 100644 --- a/src/test/java/io/jenkins/plugins/adobe/cloudmanager/config/AdobeIOProjectConfigIntegrationTest.java +++ b/src/test/java/io/jenkins/plugins/adobe/cloudmanager/config/AdobeIOProjectConfigIntegrationTest.java @@ -39,9 +39,6 @@ import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; -import com.gargoylesoftware.htmlunit.HttpMethod; -import com.gargoylesoftware.htmlunit.Page; -import com.gargoylesoftware.htmlunit.WebRequest; import hudson.security.GlobalMatrixAuthorizationStrategy; import io.jenkins.plugins.adobe.cloudmanager.test.TestHelper; import jenkins.model.Jenkins; @@ -50,12 +47,16 @@ import org.eclipse.jetty.servlet.DefaultServlet; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; +import org.htmlunit.HttpMethod; +import org.htmlunit.Page; +import org.htmlunit.WebRequest; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.jvnet.hudson.test.For; import org.jvnet.hudson.test.JenkinsRule; + import static io.jenkins.plugins.adobe.cloudmanager.test.TestHelper.*; import static org.junit.Assert.*; diff --git a/src/test/java/io/jenkins/plugins/adobe/cloudmanager/step/PipelineStepStateStepTest.java b/src/test/java/io/jenkins/plugins/adobe/cloudmanager/step/PipelineStepStateStepTest.java index 51150d8..74b8ca1 100644 --- a/src/test/java/io/jenkins/plugins/adobe/cloudmanager/step/PipelineStepStateStepTest.java +++ b/src/test/java/io/jenkins/plugins/adobe/cloudmanager/step/PipelineStepStateStepTest.java @@ -33,7 +33,6 @@ import org.apache.commons.io.FileUtils; -import com.gargoylesoftware.htmlunit.html.HtmlPage; import hudson.model.Executor; import hudson.model.Result; import hudson.util.Secret; @@ -54,6 +53,7 @@ import mockit.Mock; import mockit.MockUp; import mockit.Mocked; +import org.htmlunit.html.HtmlPage; import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition; import org.jenkinsci.plugins.workflow.cps.CpsFlowExecution; import org.jenkinsci.plugins.workflow.graph.FlowGraphWalker; @@ -63,7 +63,6 @@ import org.jenkinsci.plugins.workflow.support.actions.PauseAction; import org.jenkinsci.plugins.workflow.test.steps.SemaphoreStep; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; @@ -71,6 +70,7 @@ import org.jvnet.hudson.test.BuildWatcher; import org.jvnet.hudson.test.JenkinsRule; import org.jvnet.hudson.test.RestartableJenkinsRule; + import static io.jenkins.plugins.adobe.cloudmanager.test.TestHelper.*; import static org.junit.Assert.*;