Fetching Build Number from Last Successful build of a different build config

Greetings!

So from a build config x, i'm trying to get the build number information from a different build config y. 
I did find that i could create an artifact dependency on the build config y for which i want to find the Latest Build Number (for example).
And then refer to this from my build config x by using dep.<buildconfigID>.build.number
But the thing is, while setting an artifact dependency Team City wants us to setup an Artifact Rules to download an actual artifact. 
In my case, i do not want to download any artifacts related to that build. I just want to refer to the metadata information of that last successful build. 
Is this something i can do? Adding an artifact dependency WITHOUT any artifact rules? 
Or maybe i'm not using the best strategy at all to achieve my goal?

Thx!!

0
2 comments
Avatar
Fedor Rumyantsev

Hello Steve!

Your approach may work, if you set up a dummy artifact to be fetched - this is not exactly what artifact dependencies are designed for, but it works. Alternatives are:

1) you may use snapshot dependency - it does not require artifact exchange, but downside is that build used as a dependency will not necessarily be the latest build in that build configuration;
2) you may use REST API to retrieve latest build in a given build configuration and use its number:

/app/rest/builds/buildType:(id:<build configuration ID>),defaultFilter:false/number

This will find latest build in given build configuration, including failed builds and builds in non-default branches, and yield build number as a text/plain response. 

If you could share more details about your usage scenario, perhaps I could suggest another workaround.

0

Thank you Fedor for the fast answer on that.
Based on what you proposed, it seems the Rest API solution might be the best for me. 
Anyway, i'm going to try that and if i'm still struggling, i'll share some more details. :-)

0

Please sign in to leave a comment.