Jenkins - restart only failed stage in parallel

Viewed 609

Is there a way to restart only a failed stage in the Jenkins parallel pipeline. I have to restart entire pipeline just for one failure now.

enter image description here


The failure could be a genuine failure. We do not want to retry ans waste time. The idea here is to quickly check what the issue is, correct it and restart the stage.

1 Answers

Without knowing much into this specific problem and what exactly is causing the failure, one simple solution is to wrap your pipeline script/stage within

 retry(3){
    sh './abc.sh'
}

This will ensure that the script/stage will be retried 3 times, before jenkins marks it as a failure.

Related