Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-55267

A failed Gradle task does not log any of the error details

      When run via Jenkins pipeline, if a Gradle task fails or Gradle exits with a non-zero exit code, this line swallows the error message:

      https://github.com/jenkinsci/artifactory-plugin/blob/master/src/main/java/org/jfrog/hudson/pipeline/steps/ArtifactoryGradleBuild.java#L184

       

      This makes it extremely difficult to troubleshoot failed builds, especially as you start to mix in other things like the Docker plugin, etc. Reproducing the build is not trivial.

       

      The full error details should be displayed in the Jenkins console log.

       

          [JENKINS-55267] A failed Gradle task does not log any of the error details

          Jon McKenzie added a comment - - edited

          Here's a snippet from the console log. The gradle build is run from within a Docker container using the Docker pipeline plugin.

           

          Download https://<sanitized>/artifactory/libs-release/com/esotericsoftware/minlog/1.3.0/minlog-1.3.0.jar
          Download https://<sanitized>/artifactory/libs-release/org/yaml/snakeyaml/1.23/snakeyaml-1.23.jar
          Download https://<sanitized>/artifactory/libs-release/org/apache/logging/log4j/log4j-api/2.11.1/log4j-api-2.11.1.jar
          Download https://<sanitized>/artifactory/libs-release/io/netty/netty-buffer/4.1.31.Final/netty-buffer-4.1.31.Final.jar
          Download https://<sanitized>/artifactory/libs-release/software/amazon/awssdk/protocol-core/2.1.0/protocol-core-2.1.0.jar
          [Pipeline] }
          [Pipeline] // ansiColor
          [Pipeline] }
          [Pipeline] // withEnv
          [Pipeline] }
          $ docker stop --time=1 bc401b3124b5997f5c8a254b525737b1629050fb9058ba2e68741a5d4ee14a2e
          [Pipeline] // withDockerContainer
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] End of Pipeline
          hudson.model.Run$RunnerAbortedException
          	at org.jfrog.hudson.pipeline.steps.ArtifactoryGradleBuild$Execution.exe(ArtifactoryGradleBuild.java:193)
          	at org.jfrog.hudson.pipeline.steps.ArtifactoryGradleBuild$Execution.run(ArtifactoryGradleBuild.java:119)
          	at org.jfrog.hudson.pipeline.steps.ArtifactoryGradleBuild$Execution.run(ArtifactoryGradleBuild.java:80)
          	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
          	at hudson.security.ACL.impersonate(ACL.java:290)
          	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
          	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
          	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
          	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
          	at java.lang.Thread.run(Thread.java:748)
          Finished: FAILURE
          

          When we change the job to publish using Gradle directly instead of the plugin, we get an error from Gradle itself telling us what the problem is, namely that it's looking for a JAR file that doesn't exist:

          > Task :bootJar
          > Task :jar SKIPPED
          > Task :assemble
          > Task :check
          > Task :build
          > Task :uploadArchives FAILED
          
          FAILURE: Build failed with an exception.
          
          * What went wrong:
          Execution failed for task ':uploadArchives'.
          > Could not publish configuration 'archives'
             > Cannot publish artifact 'sanitized.jar' (/path/to/sanitized.jar) as it does not exist.
          
          * Try:
          Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
          
          * Get more help at https://help.gradle.org
          
          BUILD FAILED in 2m 37s
          5 actionable tasks: 4 executed, 1 up-to-date
          

          Jon McKenzie added a comment - - edited Here's a snippet from the console log. The gradle build is run from within a Docker container using the Docker pipeline plugin.   Download https: //<sanitized>/artifactory/libs-release/com/esotericsoftware/minlog/1.3.0/minlog-1.3.0.jar Download https: //<sanitized>/artifactory/libs-release/org/yaml/snakeyaml/1.23/snakeyaml-1.23.jar Download https: //<sanitized>/artifactory/libs-release/org/apache/logging/log4j/log4j-api/2.11.1/log4j-api-2.11.1.jar Download https: //<sanitized>/artifactory/libs-release/io/netty/netty-buffer/4.1.31.Final/netty-buffer-4.1.31.Final.jar Download https: //<sanitized>/artifactory/libs-release/software/amazon/awssdk/protocol-core/2.1.0/protocol-core-2.1.0.jar [Pipeline] } [Pipeline] // ansiColor [Pipeline] } [Pipeline] // withEnv [Pipeline] } $ docker stop --time=1 bc401b3124b5997f5c8a254b525737b1629050fb9058ba2e68741a5d4ee14a2e [Pipeline] // withDockerContainer [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline hudson.model.Run$RunnerAbortedException at org.jfrog.hudson.pipeline.steps.ArtifactoryGradleBuild$Execution.exe(ArtifactoryGradleBuild.java:193) at org.jfrog.hudson.pipeline.steps.ArtifactoryGradleBuild$Execution.run(ArtifactoryGradleBuild.java:119) at org.jfrog.hudson.pipeline.steps.ArtifactoryGradleBuild$Execution.run(ArtifactoryGradleBuild.java:80) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47) at hudson.security.ACL.impersonate(ACL.java:290) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang. Thread .run( Thread .java:748) Finished: FAILURE When we change the job to publish using Gradle directly instead of the plugin, we get an error from Gradle itself telling us what the problem is, namely that it's looking for a JAR file that doesn't exist: > Task :bootJar > Task :jar SKIPPED > Task :assemble > Task :check > Task :build > Task :uploadArchives FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':uploadArchives' . > Could not publish configuration 'archives' > Cannot publish artifact 'sanitized.jar' (/path/to/sanitized.jar) as it does not exist. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https: //help.gradle.org BUILD FAILED in 2m 37s 5 actionable tasks: 4 executed, 1 up-to-date

          Martin Aubele added a comment - - edited

          i have the same problem. 

          Artifactory Plugin 3.1.0

           

          Martin Aubele added a comment - - edited i have the same problem.  Artifactory Plugin  3.1.0  

            eyalbe Eyal Ben Moshe
            jcmcken Jon McKenzie
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: