Adding failure conditions for a build in TeamCity
By default, a build fails when either of below things happen.
- Build process exits with non-zero code
- at least one test fails
- Build process crashes
We can edit these settings from failure conditions page as shown in below image.
But TeamCity also allows us to add extra failure conditions. There are 2 broad categories of failure conditions that can be added.
- Fail when a build log contains specific text
- Fail when certain metric condition is met. For example – fail when artifact size more than 1 GB or When build duration is more than 20 minutes.
Below images show how we set up these failure conditions for a build.