This plugin makes it possible to periodically restart failed jobs according to a number of conditions. Its main purpose is to fix infrastructure failures.
Using a cron time format the user can specify at which exact time(s) the plugin should schedule failed jobs for a new build. In addition to that he/she can also specify a list of regular expressions in order to restrict which failed jobs exactly should be picked up for restart. There is a global cron tab and also every regular expression has its own such that can be individually configured. The global one is used when the cron tab for a certain regular expression is empty or cannot be compiled.
There is also the option to restart a job (independently from the regular expressions) if the following conditions hold:
Basically if these conditions hold it means that it is very possible that the code or the configuration of the job are not responsible for the failure of the last build. This leaves a infrastructure problem and PeriodicReincarnation will automatically try to build the project again.
In order to check if there was a configuration change PeriodicReincarnation uses jobConfigHistory plugin. It is an optional dependency so the plugin will continue to work if jobConfigHistory is not installed, but won't be able to tell if there was a configuration change and will always assume there wasn't one.
This feature was introduced in 1.2 and allows the immediate restart after a build failure occurs. It can be enabled globally for all projects or configured locally for every project alone. In order to prevent endless restarting there is a maximal restart depth that can also be set locally or globally. For projects where "Configure PeriodicReincarnation locally" has not been enabled restart happens like in the cron restart option - there must be a regex hit or an unchanged project that fails for the first time. For projects which have this option enabled (it can be found in the configuration page of every project, should be in the top) the restart will happen also if there is no regular expression that covers this project.
This plugin can be useful when something temporary may be causing a build to fail. its main purpose is to fix infrastructure problems preventing jobs to build successfully. For instance
It is easy to periodically restart all jobs that have failed because of some arbitrary "error_failing_the_build". Just activate the plugin, set the cron time ("* * * * *" for every minute or "*/5 * * * *" for every 5 minutes) and add this "error_failing_the_build" as regular expression.
If you want jobs failing because of this "error_failing_the_build" to be scheduled for restart right away then use the afterbuild restart option. Just enabled it and leave the regular expression in the list.
If you want different regular expressions to be triggered at different times, just configure the cron time in the regular expression itself. It is very easy, just go to the global configuration page.
The configuration for this plugin can be found in the global configuration page of Jenkins under "Periodic Reincarnation of failed builds". Each option there has a help page, so it is easier to understand and use every feature presented in the configuration of this plugin.
For individual jobs: the local configuration reveals after clicking the box "Configure PeriodicReincarnation locally" and contains just the parameters for the afterbuild restart - whether it is enabled or not and the maximal restart depth.
This feature was introduced in 1.2 and allows binding regular expressions with groovy scripts. Each time a reg ex hit occurs and a failed job is about to be restarted because of it these Groovy scripts will be executed before the restart. This can be very useful in correcting infrastructure errors like full disk or slave problems.
The plugin is open source. Feel free to make suggestions, requests and contributions!
Skip to end of metadata Go to start of metadata