2
votes

Using TeamCity 8.0.4 (build 27616)

I use a call to my TeamCity server to get a list of broken builds:

http://teamcity.exactbid.net/guestAuth/app/rest/builds/?locator=status:failure,sinceBuild:(status:success)

If I a project is in the failure state, that API call returns count =1 and the details of the broken project.

The problem is if that project has a currently running build, the API call returns count 0 and no projects in the broken list.

As soon as the project build finished (and breaks again) the count goes back to 1.

So hopefully there is something in my locator query that I can change to get broken builds even if they are currently building.

The TC ui seems to know about it because the parent projects of my broken project all show red. Just not sure how to get it right in the API query.

2

2 Answers

3
votes

Try adding running:any. Maybe running defaults to false, although I can't find that in the documentation.

2
votes

Here's how to display a list of failed builds:

http://teamcity.exactbid.net/guestAuth/app/rest/builds/?locator=status:failure

Failed builds are builds that have already finished and failed, what I think you are looking for is a way of showing builds that are running and failing:

http://teamcity.exactbid.net/guestAuth/app/rest/builds/?locator=status:error,status:running

This looks for builds that are running and contain errors (which cause the build to fail, unless explicitly told not to)

You may have to use two REST API calls to get the builds:

  1. that are finished and failed
  2. that are running and failing