Cancelled build post hook commands


Currently, if a build is cancelled (manually or via auto-cancel), the test post hook command doesn’t run. So if you need to do any clean up, it will not occur.

In our specific case, we’re using SauceLabs’ sauce connect binary to create a tunnel to CircleCI for selenium testing our feature specs. We pay per tunnel. When a build starts a tunnel per parallel process is opened, but if that build is cancelled, the test/post command to kill the tunnel doesn’t run and the tunnel just stays open until it times out. If a new build starts and can’t acquire a tunnel, that build just end up timing out.

So my request is simple, either a post command that runs specifically on cancel, or a post command that runs always, whether cancelled or successful.


+1 very useful feature.

I would add failed builds and timed out builds to the list of scenarios we’d want to execute a POST TEST command.

In our case, we are using CircleCI to run builds/tests on Salesforce and when stuff happens on Circle, processes are left running on salesforce.


+1 on canceled and failed builds



we’re constructing an environment on the fly; it’d be costly to miss the destroy step.


We are doing the same with Salesforce, currently it destroys the container but leaves the Salesforce deployment running, taking up our limited number of Salesforce instances. This would be incredibly valuable.


+1 on this!
We are missing the destroy step after cancelled builds as well and is not cool.

For circleci 2.0 this one could be related I guess with: Create value `cancelled` for `run`'s `when`


+1, we also have a lot of external infrastructure we need to safely clean up when builds are cancelled.


+1 definitely need this