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:
stage 'parallel with failFast'
def error;
node {
try {
parallel(
b: { error 'died' },
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:
stage 'parallel with failFast'
def error;
node {
try {
parallel(
b: { error 'died' },
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?