API: Locating a running build by the agent building it
Answered
If I know the id of an agent, I'd like to be able to use the API and a locator to find the build running on that agent if one is running. Is this possible or do I need to iterate over the list of all builds?
Thanks,
Jasen
Please sign in to leave a comment.
Hi Jasen,
Please use the following request:
Thanks, Alina.
I can get a list of builds by omitting the "running:true" clause, but I always get a 0-count list -- even with agents I can see are working on a build -- using it.
My results look like this using "running:true":
<builds count="0" href="/app/rest/builds?locator=agentName:<agentName>,running:true"/>
where <agentName> is a legitimate name for an agent.
Has this feature been deprecated since this was posted?
Nevermind. It looks like it's possible to get the current build with a request like this:
https://teamcity:8111/httpAuth/app/rest/builds?locator=running:true,agentName:<Valid Agent Name>,branch:
It's the branch bit at the end that appears to make it work.
Hello Jasen,
By default only builds from the default branch are returned. To retrieve all builds, the following locator should be used: