Scripts pipeline: 流程控制之 – try/catch
stage('Test') {
node{
echo "This is test stage which run on the slave agent."
try {
echo "This is in the try block."
sh 'exit 1'
}catch (exc) {
echo "Something failed, I'm in the catch block."
}finally {
echo "Finally, I'm in the finally block."
}
}
}
Scripts pipeline: 流程控制之 – try/catc
Demo: try / catch 运行演示