Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins - restart only failed stage in parallel

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.

like image 203
RamPrakash Avatar asked Sep 06 '25 04:09

RamPrakash


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.

like image 149
Isaiah4110 Avatar answered Sep 09 '25 10:09

Isaiah4110