Using the Build Number of another Configuration
Is there a way to get the build number of another configuration without causing a rebuild? I have tried using a snapshot dependency and I am able to get the Build Number that way, however it is always causing a rebuild of the other Configuration. I am trying to avoid that.
Please sign in to leave a comment.
You can use an artifact dependency instead of snapshot one.
If it didn't help — please describe your case im more details.
Isn't the artifact dependency for copying files?
For copy artifacts from one build to another. However, it can be also used to share/provide a build number.
I'll try to help you if you explain your case.
Hi,
I just want to share a build number between builds.
Would you mind explaining how do you do this with an artifact dependency?
Cheers
Hello,
If there is a dependency (snapshot or artifact) is configured between A and B build configurations (B depends on A), then in B you can get build number from A using the following dependency property:
where <btID> is the ID of the build configuration A. Read more about dependency properties.
Please watch/comment the issue related to sharing a build number TW-7745.
Hi,
right, I've seen that in the doc and tried to use this
But it doesn't work because my builds are unrelated.
A is a Maven build that uploads an artifact in a Maven central repository (which version is tagged with TC build number)
B is an Ansible build that downloads this artifact from the repo and deploys it.
B needs to know A build number to download the right version.
I've tried to introduce an artifact dependency in B but I just don't know how to do this. This seems counter intuitive as I just need the a build number.
If build configurations are not related, then you can configure fake artifact dependency (for example "dummy-rule" .teamcity/settings/digest.txt=> dependencies/dummyDependency).
Also you can use REST API request in B build configuration to get the build number of the latest A build, for example:
http://teamcity:8111/httpAuth/app/rest/builds/id:<buildId>/resulting-properties/build.number
thanks for your tips, I got it working and understand now a bit better the concept of non Maven artifacts in Teamcity.
Let me mention how to use the rest API to identify your build by its name (it took me a while to figure out):
http://teamcity:8111/httpAuth/app/rest/builds/buildType:<Build configuration ID>/resulting-properties/build.number