How to get the build id of a snapshot dependency?
I have build B depending on build A via snapshot dependency.
In build B build step I need the build id of A to invoke via http %teamcity.serverUrl%/downloadBuildLog.html?buildId=<buildId of A>
I see I can get the build number like so:
%dep.A.build.number%
But I need the build id, unfortunately %dep.A.build.id% seems not accessible from build B. The build id of A seems only accessible from build A.
How can I get the build id of A in build B?
Or, how else can I download the build log of A from build B ?
Please sign in to leave a comment.
Hello,
If you just need the build log and you don't need to invoke it via http %teamcity.serverUrl%/downloadBuildLog.html?buildId=<buildId of A>
, you could add an artifact dependency and add a dependency to the build log (you can pick it from the hidden artifacts.
As an alternative, perhaps you could explore the REST API?
First to get the snapshot dependencies:
And from the snapshot depencency data, retrieve the build id that you need with a call such as the one below to retrieve the last build from a given build configuration:
Here is the documentation regarding the REST API if you want to explore it further:
https://www.jetbrains.com/help/teamcity/rest/snapshotdependencies.html
https://www.jetbrains.com/help/teamcity/rest/build.html
Thank you,
Guilherme