We will use Jenkins Naginator Plugin to rerun the Failed/Unstable builds. This plugin allows you to automatically reschedule a build after a build failure.
Configure
- Go to Manage Jenkins > Manage Plugin > Available Tab > Search 'Naginator' and install and restart
- After installing the plugin, add the Post-Build action "Retry build after failure" on your Jenkins Job configuration page.
- Set Build Retry
Above set Build retry screenshot shows that:
- Job is enabled to rerun for unstable as well as Failure builds
- Delay the build execution by Fixed 60 seconds
- Maximum number of successive failed builds count is set to 3 (Limits successive failed build retries. Set to 0 for no limit.)