Get build number of another build without a snapshot or artifact dependency


We currently have a snapshot dependency set up on another build so that we can grab and use it's build number (it is basically a set of regression tests that run on previously built binaries).

However, this regularly triggers the downstream dependency to start building, and the regression build to wait for a long time.

We just want the build number of the last successful build - we don't want to trigger a snapshot build, and we don't want to create an artifact dependency (the other build doesn't even publish any artifacts).

Literally the only thing I want to resolve is the build number of the last successful build of the other project, without doing anything else, but I can't find a way to do it.

How can I go about this? I have found the documentation about the Rest URL that can be used to get a last successful build number, but as far as I know I can't resolve this API call into a TeamCity property that I can use in my other build.



A quick google found the Auto Incrementer plugin

It looks old from 2011, but I can see it works on version 7 & 8 of TeamCity from this dicussion:

Hope that helps


Yeah, thanks. I looked at that plugin and other variations of it.

All the "shared build" incrementer plugins will increment the build number if I share it between builds, I just want to reference the build number from the other build without taking a dependency on it, and without changing it.



In this case you need to use REST API as you mentioned above. You can use the result of REST API request directly in build script or initialize build parameter using service message
##teamcity[setParameter name='ddd' value='fff']


Thank you, this is one way I thought of to do it as well.

But I would really like to be able to manage this inside TeamCity and not call out to a separate build script which isn't part of TeamCity. Ideally my builds shouldn't have knowledge of the internals of TeamCity and TeamCity shouldn't have knowledge of the internals of my builds.

I might end up doing another hack instead, e.g. force my dependency to publish an artifact just so that I can get a reference to its build number.


We have this feature request, please feel free to comment/vote or create new issue.


Please sign in to leave a comment.