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

            Hide
            ialbors Ignacio Albors added a comment -

            I see on the Changelog (https://github.com/jenkinsci/workflow-basic-steps-plugin/blob/master/CHANGELOG.md):

             

            • Fix: The implementation of JENKINS-29144 added in version 2.21 caused exceptions thrown by some implementations of SimpleBuildStep to be wrapped in InvocationTargetException incorrectly (PR #128)

            It seems related  to this isse. Is it the case?

             

             

            Show
            ialbors Ignacio Albors added a comment - I see on the Changelog ( https://github.com/jenkinsci/workflow-basic-steps-plugin/blob/master/CHANGELOG.md):   Fix: The implementation of JENKINS-29144 added in version 2.21 caused exceptions thrown by some implementations of SimpleBuildStep to be wrapped in InvocationTargetException incorrectly ( PR #128 ) It seems related  to this isse. Is it the case?    
            Hide
            ialbors Ignacio Albors added a comment -

            Jesse Glick: forgive me if I'm wrong but I assigned this to you since yo seem to be the one who fix the issue.

            Show
            ialbors Ignacio Albors added a comment - Jesse Glick : forgive me if I'm wrong but I assigned this to you since yo seem to be the one who fix the issue.
            Hide
            jglick Jesse Glick added a comment -

            Please do not assign issues. Developers assign issues to themselves if and when they plan to work on a fix.

            Show
            jglick Jesse Glick added a comment - Please do not assign issues. Developers assign issues to themselves if and when they plan to work on a fix.
            Hide
            jglick Jesse Glick added a comment -

            Was fixed in 2.22.

            Show
            jglick Jesse Glick added a comment - Was fixed in 2.22.
            Hide
            ialbors Ignacio Albors added a comment -

            Jesse Glick: sorry about that!

            Show
            ialbors Ignacio Albors added a comment - Jesse Glick : sorry about that!
            Hide
            jglick Jesse Glick added a comment -

            No problem, guess I should have filed this in Jira to begin with.

            Show
            jglick Jesse Glick added a comment - No problem, guess I should have filed this in Jira to begin with.

              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: