find out which build triggered this one

Answered

The context of this is that I want to update a third party system with statistics from a build once it has finished (eg test passed /failed code coverage). I don't think i am able to do this as part of the build, but if I can that 's great. 

I want to report the statistics of build config A. Currently my plan is to have a build config, X which is triggered by the finishing of the build A and runs a script. This build will then get the statistics from build A by calling the rest API, then call the third party system's API with that data.

but also I want to be able to do the same thing for Build configs B and C, without having to add more 'reporting' builds. To be able to do that, I need to be able to detect, when running build config X, was this build triggered by the finishing of A, B or C. hopefully there's a variable I can feed into a script.

3 comments

Hello Jonny,

You can add custom charts on build configuration Statistics page. You can use any of the reported statistics values, e.g. "Number of Passed Tests" or add custom statistics. Also you can download all data in CSV from this page. For more details see the section: https://confluence.jetbrains.com/display/TCD10/Statistic+Charts. 

The information about how the build was triggered is stored in teamcity.build.triggeredBy parameter. 

0

teamcity.build.triggeredBy, when I see it in the parameters tab after a build, shows 

Utilities :: Test Build Config, build #7

which is ideal, however when I used that as an argument in a powershell build step, it seems to just show 

Utilities

- which isn't great as I need to know the build configuration as well as the project 

does this parameter come out differently in a script step, or am I mistaken?

0

I was mistaken! - as usual

I needed to enclose the variable substitution in quotes for is to work as a parameter for a powershell script

"%teamcity.build.triggeredBy%"

 

0

Please sign in to leave a comment.