Early Access Program Features Tips & Tricks

Fail build on specific log message

Previously described Fail build on metric change feature is not the only new way of controlling build status and detecting build failures. In TeamCity 7.0 we introduce one more useful feature that allows to mark build as failed, in case when certain line is met in build log.

When starting various processes within a build TeamCity monitors their status by inspecting exit code and performing some other tricks. However in some cases providing build exit code is not an easily achievable task while process output can tell us much more details. TeamCity can inspect all lines in build log for some particular text occurrence that indicates build failure: this feature was actively voted in scope of  TW-3917 and some related issues.
The only thing you need to know to configure this feature is what message is an indicator of build failure. Just add new build failure condition on the dedicated page:

Note, that you can instruct TeamCity to look for a line containing or matching a Java Regular Expression regexp text that appears/doesn’t appear during the build. When the condition is set, the interface looks like:

Here’s how a build failure looks when caused by such condition:

The feature is not completed yet, so your comments and feedback are very much welcome. To try it live, install TeamCity 7.0 EAP build, we recommend the next EAP build which is about to be released in the nearest future.

Enjoy!


image description