Thường khi 1 stage bị rơi vào trạng thái UNSTABLE thì các stage sau vẫn action và không bị dừng.
pipeline{
agent{
label "k8s-permanent"
}
options {
disableConcurrentBuilds()
}
stages{
stage("Build"){
steps{
echo "setting build unstable"
script{
currentBuild.result = "UNSTABLE"
}
}
}
stage("Deploy"){
steps{
echo "deploy running"
}
}
}
}
Ấn save và apply rồi ấn build.


Vậy giờ anh em muốn dự pipeline khi 1 stage bị UNSTABLE, thì thêm option như sau
pipeline{
agent{
label "k8s-permanent"
}
options {
skipStagesAfterUnstable()
}
stages{
stage("Build"){
steps{
echo "setting build unstable"
script{
currentBuild.result = "UNSTABLE"
}
}
}
stage("Deploy"){
steps{
echo "deploy running"
}
}
}
}
