-
Bug
-
Resolution: Duplicate
-
Minor
-
None
When wrapping a long-running step inside a parallel branch in withCredentials, failFast will no longer result in the long-running branch being terminated. I'll use the failFast example at https://github.com/kmadel/jenkins-workflow-examples/blob/master/failFast.groovy:
This works
stage 'parallel with failFast' def error; node { try { parallel( b: { error 'died' }, // make sure this branch takes longer than b a: { sleep 35; writeFile text: '', file: 'a.done' }, failFast: true ) } catch (e) { error = e.toString() } } stage 'failFast Success with error' echo "error: ${error}"
That works fine. However, if I try to use withCredentials, the longer-running a branch continues normal execution, and the build only fails once it's done:
This doesn't work
stage 'parallel with failFast' def error; node { try { parallel( b: { error 'died' }, // make sure this branch takes longer than b a: { withCredentials([[$class: 'StringBinding', credentialsId: 'some-credentials-id-here', variable: 'SOME_ENV_VARIABLE']]) { sleep 35 writeFile text: '', file: 'a.done' } }, failFast: true ) } catch (e) { error = e.toString() } } stage 'failFast Success with error' echo "error: ${error}"
Any ideas what's going on here, or thoughts on a workaround?
- duplicates
-
JENKINS-34637 pipeline DSL: timeout() does not work if withEnv() is enclosed
- Resolved