Need to fail the Ant build runner by searching for patterns in Ant output

Hi,

We use Perforce Ant Tasks in our build.xml.
Sometimes these tasks don't fail in Ant, but actually don't do their job:

: ... - can't edit exclusive file already opened
: ..- also opened by ...
: copy (<1s)
: Copying 1 file to C:\TeamCity\buildAgent\work\...
: p4submit (<1s)
: Submitting change 891922.
: No files to submit.

In the example these was an error with getting access to the file, which leads to a problem with submitting it.

So this build didn't failed, but Perforce work wasn't done as well.

Is there a way to fail this build in TeamCity by checking Ant output for fixed text, i.e. "No files to submit"?
I mean if there is text containing pre-configured patterns then build is failed.

--
Thanks,
Andrey

Edited by: nouveau on Jun 18, 2008 5:26 PM

1 comment

Andrey,

Currently, there is no ability to detect arbitrary messages in the build log and change the status of the build. Please vote/watch the corresponding issue in our tracker: http://jetbrains.net/tracker/issue/TW-3917

The possible workaround is to detect the error in the build script and change the build status. It can be done via a service message. You just need to write the line into the standard output:

##teamcity[buildStatus status='FAILURE' text='Could not submit file to Perforce.']

The current limitation is that the line will not be processed if written with Ant's "echo" task.

Another approach is to write your own plugin to TeamCity that will process the build log and change the status of the build accordingly. Please let us know if you choose this way so that we can provide you with pointers in the open API.

--
Best regards,

Yegor Yarko
Project Manager
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0

Please sign in to leave a comment.