-
Story
-
Resolution: Won't Fix
-
Minor
-
None
When using error 'foo' in a scripted pipeline, it seems that the currentBuild.result or currentBuild.currentResult are not set accordingly. Here is a simple reproductible script:
node { try { echo currentBuild.currentResult error 'foo' } finally { echo currentBuild.currentResult } }
and the output isĀ
[Pipeline] node Running on master in /tmp/jenkins-home/workspace/foo [Pipeline] { [Pipeline] echo SUCCESS [Pipeline] error [Pipeline] echo SUCCESS [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline ERROR: foo Finished: FAILURE
Is this because, in the finally block, the "exception" thrown by error happened but it not yet handled to quite the execution of the currentBuild?