Help with build locator

Hi!

I have a project with two build configurations, and what I'd like to have is a persistent link to a latest successful build in each configuration.

But for some reason api build locator always returns count="0" for one of build configurations:

http://<teamcity>/httpAuth/app/rest/builds/?locator=buildType:<project>_82
<builds count="0" href="/httpAuth/app/rest/builds/?locator=buildType:<project>_82"/>

Works great for the other one:

http://<teamcity>/httpAuth/app/rest/builds/?locator=buildType:<project>_Mainline,status:success,count:1
<builds count="1" href="/httpAuth/app/rest/builds/?locator=buildType:<project>_Mainline,status:success,count:1" nextHref="/httpAuth/app/rest/builds/?locator=buildType:<project>_Mainline,count:1,start:1,status:success">
  <>
</builds>

Configuration names should be okay, I am using the one from the web ui and I see the same ids in project definition via api:

http://<teamcity>/app/rest/projects/<project>/buildTypes
<buildTypes count="2">
<buildType id="<project>_Mainline" name="<>" description="" projectName="<>" projectId="<project>" href="/httpAuth/app/rest/buildTypes/id:<project>_Mainline" webUrl="http://<teamcity>/viewType.html?buildTypeId=<project>_Mainline"/>
<buildType id="<project>_82" name="<>" description="<>" projectName="<>" projectId="<project>" href="/httpAuth/app/rest/buildTypes/id:<project>_82" webUrl="http://<teamcity>/viewType.html?buildTypeId=<project>_82"/>
</buildTypes>

Im curious if there is something broken with my setup or maybe Im doing something wrong :/

 

Any help is appreciated, thanks!

0
3 comments
Hello Andrey,

Can you please let me know if `http:///httpAuth/app/rest/builds/?locator=buildType:_82,defaultFilter:false` helps to show the missing builds?
By default, `defaultFilter` is set to `true` - which means that by default we show only successful non-personal builds from a default branch.

If that does not help, could you please share a screenshot of your builds list under `_82`?
1

Yup, passing defaultFilter:false to the locator solves the issue for me!

I guess the problem was that most of the builds were personal ones and not git-triggered.

 

Thank you so much!

0
Hello Andrey,

Glad to hear that! Just a quick clarification to make sure we are on the same page - how the build was triggered does not actually play a role here. Suppose a build has a VCS root with only a default branch, and no branch specification configured, so only the branch that is selected as a default is available - filter will let all successful non-personal builds from that branch into the response. Now, let us consider a different build with a VCS root where we have a branch specification and, as a result, we also have some feature branches available for build. For any of the feature branch builds, no matter if they were triggered manually or via a trigger, they will not be included into the response by default.

Please have a great day!
0

Please sign in to leave a comment.