문제

I'm using the Team City API to get failed builds (for display in a JavaScript application).

I'd like to find out who committed the change in Git, which caused the build to fail. Then we can put the developer's name big & bold on the status display...

But I can't find where to get the user information. Any pointers please?

도움이 되었습니까?

해결책

You can get a list of changes for a given build id via the REST API, like this:

http://<yourTCServer>/httpAuth/app/rest/changes?build=id:<buildId>

The response from that request will include one or more "change" entries, depending on how many commits were included in the build. Each of those entries will look something like this (assuming response is formatted as XML; you can get JSON if you prefer):

<change id="####" version="<commit id>" href="/httpAuth/app/rest/changes/id:####" />

You can then follow the returned href to get the details of each change, which includes a tag for the related user looking like this:

<user username="<some TC username>" name="<some TC user's full name>" ... />

The root "change" element will also include the git username, but if you've got all of your users setup correctly within TC so that there is an association between the git users and TC users, you'll get the "user" element I showed above and it will contain more info.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top