I have a series of stages that perform quick checks. I want to perform them all, even if there are failures. For example:
stage(\'one\') {
node {
I had the same concern. I was able to resolve it doing this.
Second stage will show in red and be marked as failed while the rest of the stages will keep running. You can set a flag and at the end of the stages check the flag and inform the status of the whole build.
node {
def build_ok = true
stage('one') {
sh 'exit 0'
}
try{
stage('two') {
sh 'exit 1' // failure
}
} catch(e) {
build_ok = false
echo e.toString()
}
stage('three') {
sh 'exit 0'
}
....
if(build_ok) {
currentBuild.result = "SUCCESS"
} else {
currentBuild.result = "FAILURE"
}
}
Use
propagate: false
flag to move to next stage when previous stage fails.
example:
stage('<stage-name>'){
node('<node-name>'){
build job: '<job-name>', propagate: false
}
}
stage('<stage-name>'){
node('<node-name>'){
build job: '<job-name>'
}
}