打卡学习pipeline第一天:2020/04/20
options可以将其放在pipeline块或stage块中
一、retry发生失败重试,包括第一次失败
1)、正常执行
pipeline {
agent any
options {
retry(4)
}
stages {
stage('build') {
steps {
echo "OK"
//error("emmm....") //error主动报错,中止当前pipeline
}
}
}
}
2)失败执行
pipeline {
agent any
options {
retry(4)
}
stages {
stage('build') {
steps {
echo "OK"
error("emmm....") //添加error
}
}
}
}