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

InvocationTargetException instead of AbortException

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Labels:
      None
    • Environment:
      workflow-baisc-step: 2.21 version
      copyartifact: 1.45.1 version
    • Similar Issues:

      Description

      Since 2.21 version of workflow-basic-steps plugin we've seen  the next problem.

       

      Working with the next test pipeline and using copyArtifact, when the target  project doesn't exist (for example), our catch should take care of it.

       

      In fact it always threw an AbortException.

       

       

      // pipeline {
          agent none    stages {
              stage ("Stage1") {
                  agent any 
                  steps{
                      script {                    try{
                              echo "Collecting artifacts from job." 
                              copyArtifacts filter: "file", fingerprintArtifacts: true, projectName: "NOTEXIST", selector: lastSuccessful(), target: "WHATEVER"
                          }catch(hudson.AbortException e){
                              print e
                              echo "Job  not found, launching build." 
                          }/*catch(Exception e){
                              print e
                          }*/                    echo 'Otra cosa'
                      }
                  }
              }
              stage ("Stage2") {
                  agent any 
                  steps{
                      script {
                          echo "More things" 
                      }
                  }
              }
          }
      }
      

       

      But now we get an InvocationTargetException and the catch code is never run as seen in the next log:

       

      Running on Jenkins in /var/jenkins_home/workspace/test
      [Pipeline] {
      [Pipeline] script
      [Pipeline] {
      [Pipeline] echo
      Collecting artifacts from job.
      [Pipeline] copyArtifacts
      [Pipeline] }
      [Pipeline] // script
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] stage
      [Pipeline] { (Stage2)
      Stage "Stage2" skipped due to earlier failure(s)
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] End of Pipeline
      hudson.AbortException: Unable to find project for artifact copy: NOTEXIST
      This may be due to incorrect project name or permission settings; see help for project name in job configuration.
      	at hudson.plugins.copyartifact.CopyArtifact.perform(CopyArtifact.java:452)
      	at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:112)
      Caused: java.lang.reflect.InvocationTargetException
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:92)
      	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:70)
      	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
      	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
      

      Using again 2.20 version of the plugin fixes the issue.

      We can see there's been changes related to CoreStep.java:

       

      https://github.com/jenkinsci/workflow-basic-steps-plugin/compare/workflow-basic-steps-2.20...workflow-basic-steps-2.21?short_path=4ac32a7#diff-4ac32a78649ca5bdd8e0ba38b7006a1e

       

       

      Thanks!

       

        Attachments

          Issue Links

            Activity

            ialbors Ignacio Albors created issue -
            ialbors Ignacio Albors made changes -
            Field Original Value New Value
            Assignee Jesse Glick [ jglick ]
            jglick Jesse Glick made changes -
            Assignee Jesse Glick [ jglick ]
            jglick Jesse Glick made changes -
            Assignee Jesse Glick [ jglick ]
            jglick Jesse Glick made changes -
            Released As https://github.com/jenkinsci/workflow-basic-steps-plugin/blob/master/CHANGELOG.md#222
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Resolved [ 5 ]
            jglick Jesse Glick made changes -
            Link This issue is caused by JENKINS-29144 [ JENKINS-29144 ]

              People

              Assignee:
              jglick Jesse Glick
              Reporter:
              ialbors Ignacio Albors
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: