通过将并行步骤和阶段步骤都包装在try块中,将错误从并行分支内的try / catch块抛出到阶段块,可以实现UI响应。不像设置属性那样干净,但是对于Blue Ocean和Stage View确实具有正确的UI响应。
try {
stage('example') {
try {
parallel (
'A' : {
try {
// Example...
}
catch (error) {
// Mark branch as failed somewhere
throw error
}
},
'B' : {
try {
// Example...
}
catch (error) {
// Mark branch as failed somewhere
throw error
}
}
)
}
catch (error) {
throw (error)
}
finally {
// Parallel branch A failed, do you want to continue? etc...
}
}
}
catch (error) {
println (error)
}