2

I am using the latest version of TeamCity and I'm trying to get a build to fail if the number of occurrences of the word "Warning:" exceed a certain level.

I am using the new build failure conditions on the build log with a regular expression. I have another quesiton on this on stackoverflow for the actual regex.

https://stackoverflow.com/questions/10393489/regular-expression-to-determine-if-text-has-no-more-than-n-occurrences-of-a-word/10394765#10394765

the actual regex is

(?:\\bWarning:.*?){1000,}

or a modified version to enable single line matching

(?s)(?:\\bWarning:.*?){1000,}

either of these expressions, simply pass all the time.

1 Answers1

1

Problem is that teamcity is not 100% clear about how the regex works.

It only operates on a per-line basis. I needed to check the complete log file. This was ultimately solved by having msbuild output the log file to a separate location and check it using a new build step.