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.

8 comments
Comment actions Permalink

You can use an artifact dependency instead of snapshot one.

If it didn't help — please describe your case im more details.

0
Comment actions Permalink

Isn't the artifact dependency for copying files?

0
Comment actions Permalink

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.

0
Comment actions Permalink

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

0
Comment actions Permalink

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:

%dep.<btID>.system.build.number%

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.
0
Comment actions Permalink

Hi,

right, I've seen that in the doc and tried to use this

%dep.<btID>.system.build.number%

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.
0
Comment actions Permalink

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

0
Comment actions Permalink

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

0

Please sign in to leave a comment.