Can I run a script on a failed build

Hi, Appologies in advance but very new to TeamCity and trying to workout if its possible to run a script if a build fails

Currently my project updates status to another system to say a build is underway at end of the process I update state with a script via a build step that the status is completed. My issue is I need to be able to run a script to set status to failed if my build fails.

Would you be able to give some guioidence on the best approach of this via TeamCity

Thanks in advance

1 comment
Comment actions Permalink


For the time being, there is no easy way to perform an operation within a build based on previous steps statuses.

Current options would be:
- (not TeamCity-specific) adapt your build script so that the buidl status analysis and actions are performed within the same build script that does the main build logic
- write an external aplication that will get last finished build and it's status via REST API and perform the necesary actions.
- write a TeamCity Java plugin to do something on build finish

BTW, there is a bit related feature request in our tracker.


Please sign in to leave a comment.