-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
workflow-baisc-step: 2.21 version
copyartifact: 1.45.1 version
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:
Thanks!
- is caused by
-
JENKINS-29144 SimpleBuildStep to receive EnvVars
- Resolved