Recently started supporting temcity for work and have been working on an integration to monitor when a job have been kicked off. Using the build api I can pull the build infomration from the /httpAuth/app/rest/build/id:XYZ endpoint.
In the response data, there is a value called running, which is true when the build is running and false when it finishes. I have also noticed that 'status' is set to SUCCESS during the entire run of the build.
What I am seeing, in the case of a failed run, is that running is set to false before status is set to ERROR. So that if I monitor the value of running I don't necessarily get the final state of the build in the first response where running is false.
I have switched to looking for the finishedDate in the response form the API and once that is there it seems that things are finalized, but again, there are cases where running is false but the finishedDate isn't set yet.
Is testing for the finishedDate the correct way to tell that a job has completed and that all the data has been updateds?
Also, why is the status set to SUCCESS during the entire run of the build? Seems like it should be empty or in some other non success/failure state during the run.
We are using TeamCity Professional 7.0.2 (build 21349)