How to start a job if the current task is not completed?
You can use Load Additional Plugin for this:
my_project
will only run if the build fails.
Note : if you want to run the same job, you must understand that this is a chance to have an infinitive loop. If the build always fails, it will run over and over ...
source to share
The best solution is to use the Naginator plugin .
If the build fails, it will be rescheduled after the time you specified. You can choose how many times to repeat the task. For each consecutive failed build, you can extend the timeout period.
source to share
Jenkins Naginator plugin
Jenkins Naginator Plugin can be used to automatically reconfigure a build after a failure.
This becomes very useful in scenarios where a build fails due to unavoidable reasons such as database connection is lost, file system is unavailable, etc.
Configuration
The rescheduling configuration is available as a post-build action. There are several configurations to make the right choice based on the expected (unavoidable) reason for the build failure.
More details on config here with screenshot.
source to share