Running a Post Build script when a Jenkins job is aborted

Jose picture Jose · Jul 30, 2014 · Viewed 23.3k times · Source

Is there a possible way / plugin that can run a post build script when a Jenkins job is aborted. I do see that the post build plugin provides an action to execute a set of scripts, but these can be run only on 2 options either a successful job or a failed job.

Answer

tim picture tim · Aug 28, 2014

This question is positively answered here.

The Post Build Task plugin is run even if a job is aborted.

Use it to search the log text for "Build was aborted" and you can specify a shell script to run.

Works like a charm. :-)