jfrog / jenkins-artifactory-plugin

Jenkins artifactory plugin
http://jenkins-ci.org/
115 stars 186 forks source link

rtMaven.run fails with NPE, in jenkins. Using amazoncorretto image to run a project #898

Open rahulks993 opened 8 months ago

rahulks993 commented 8 months ago

Hello,

Our Jenkins build is currently encountering failures on multiple projects, and we're uncertain about the root cause of the issue. Previously, we used OpenJDK images for the builds, but since transitioning to Amazon Corretto, we've been experiencing NullPointerException errors while running on an EC2 Jenkins node. I'd like to provide the versions of Jenkins, Artifactory, Java, and Maven in hopes that someone can assist me in resolving this problem.

Jenkins Artifactory Plugin version: 3.18.0 Jenkins version: Jenkins 2.387.1 Java: amazoncorretto-8 JAVA_HOME=/usr/lib/jvm/java-1.8.0-amazon-corretto MAVEN_HOME=/usr/share/maven

Jenkins log:

18:29:33  Artifactory integration is enabled
18:29:33  [ion_example-library-maven_master@2] $ docker exec --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** 72bb62edf48f47bb7492abb6ddb173ce0d7c4ea6fec8abef41b086f6c1037686 /usr/lib/jvm/java-1.8.0-amazon-corretto/bin/java -classpath /usr/share/maven/boot/* -Dmaven.home=/usr/share/maven -Dmaven.conf=/usr/share/maven/conf -DbuildInfoConfig.propertiesFile=/opt/appadmin/buildroot/workspace/ion_example-library-maven_master@2@tmp/artifactory/buildInfo10368569271467580023.properties -Dm3plugin.lib=/opt/appadmin/buildroot/workspace/ion_example-library-maven_master@2@tmp/artifactory/cache/artifactory-plugin/3.18.0 -Dclassworlds.conf=/opt/appadmin/buildroot/workspace/ion_example-library-maven_master@2@tmp/artifactory/classworlds17219468755132725245conf -Dmaven.multiModuleProjectDirectory=/opt/appadmin/buildroot/workspace/ion_example-library-maven_master@2 org.codehaus.plexus.classworlds.launcher.Launcher -f pom.xml clean install -Dmaven.test.skip=true

18:29:33  SLF4J: Actual binding is of type [org.slf4j.impl.MavenSimpleLoggerFactory]
18:29:35  [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Scanning for projects...
18:29:35  [main] INFO org.jfrog.build.extractor.maven.BuildInfoRecorder - Initializing Artifactory Build-Info Recording
18:29:35  [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - 
18:29:35  [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------< example-library-maven >-------------------
18:29:35  [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Building example-library-maven 1.0.4-SNAPSHOT
18:29:35  [main] INFO org.apache.maven.cli.event.ExecutionEventLogger -   from pom.xml
18:29:35  [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - --------------------------------[ jar ]---------------------------------
18:29:35  [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
18:29:35  [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - BUILD FAILURE
18:29:35  [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
18:29:35  [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Total time:  0.226 s
18:29:35  [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Finished at: 2023-11-09T12:59:35Z
18:29:35  [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
18:29:35  [main] ERROR org.apache.maven.cli.MavenCli - NullPointerException
18:29:35  [main] ERROR org.apache.maven.cli.MavenCli - 
18:29:35  [main] ERROR org.apache.maven.cli.MavenCli - To see the full stack trace of the errors, re-run Maven with the -e switch.
18:29:35  [main] ERROR org.apache.maven.cli.MavenCli - Re-run Maven using the -X switch to enable full debug logging.
18:29:35  ERROR: Couldn't execute Maven task. RuntimeException: Maven build failed with exit code 1

java.lang.RuntimeException: Maven build failed with exit code 1
    at org.jfrog.hudson.pipeline.common.Utils.launch(Utils.java:280)
Caused: java.lang.RuntimeException: Maven build failed. Couldn't execute Maven task. RuntimeException: Maven build failed with exit code 1
    at org.jfrog.hudson.pipeline.common.Utils.launch(Utils.java:285)
    at org.jfrog.hudson.maven3.Maven3Builder.RunMaven(Maven3Builder.java:121)
    at org.jfrog.hudson.maven3.Maven3Builder.perform(Maven3Builder.java:116)
    at org.jfrog.hudson.pipeline.common.executors.MavenExecutor.execute(MavenExecutor.java:72)
    at org.jfrog.hudson.pipeline.scripted.steps.ArtifactoryMavenBuild$Execution.runStep(ArtifactoryMavenBuild.java:65)
    at org.jfrog.hudson.pipeline.scripted.steps.ArtifactoryMavenBuild$Execution.runStep(ArtifactoryMavenBuild.java:51)
    at org.jfrog.hudson.pipeline.ArtifactorySynchronousNonBlockingStepExecution.run(ArtifactorySynchronousNonBlockingStepExecution.java:55)
    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)

It fails while running this piece of code: server = Artifactory.server 'Artifactory Pro' rtMaven = Artifactory.newMavenBuild() rtMaven.deployer releaseRepo: 'libs-release-local', snapshotRepo: 'libs-snapshot-local', server: server rtMaven.deployer.deployArtifacts = false buildInfo = Artifactory.newBuildInfo() rtMaven.run pom: 'pom.xml', goals: 'clean install -Dmaven.test.skip=true', buildInfo: buildInfo

rahulks993 commented 8 months ago

@yahavi Could you please help me here?

yahavi commented 8 months ago

Hey @rahulks993, You're using a version that was released almost a year ago. Any possibility you could think about upgrading to the latest release and inform us if that resolves the issue?

rahulks993 commented 8 months ago

@yahavi The most recent release of Artifactory is 4.0.0. Nevertheless, I'd appreciate your recommendation on which version I should proceed with. For instance, should I opt for version 3.18.1 or 3.18.3? I came across an issue that appears to have logs closely resembling my own situation.

yahavi commented 8 months ago

@rahulks993 The problem raised in https://github.com/jfrog/jenkins-artifactory-plugin/issues/734 got resolved through https://github.com/jfrog/build-info/pull/714 in version 3.18.4.

If there are Gradle jobs in your Jenkins instance utilizing Gradle versions below 6.8.1, you have the option to upgrade to the latest v3 version, 3.18.12. Otherwise, consider upgrading to the latest major, 4.0.0.

By the way, we've introduced a JFrog CLI-based JFrog plugin that can operate alongside the traditional Artifactory plugin. The JFrog CLI is among the favored tools in the community, and I suggest opting for it over the older Jenkins plugin.

rahulks993 commented 8 months ago

@yahavi I'll try upgrading to 3.18.4 or 3.18.12 and I'll confirm you back whether the issue which we are facing is resolved or not. If it doesn't then I'll consider upgrading to 4.0.0 . However we are not having gradle jobs in our jenkins instance we are still using maven.

rahulks993 commented 8 months ago

@yahavi Thanks for your recommendation, the issue is resolved now with 3.18.4. You may close this question now