Access trigger from build scripts
Hello!
I was wondering if there is any way to know within a build script, how that build was triggered.
My case is as follows: I have some build configurations to run load tests on our application, they have a Schedule Trigger to run daily and the results are processed automatically. Now I would also like to be able to run the build on demand, but then the results should be processed differently.
Is there any environment variable of some kind, or another indicator I can use in a script to determine how the test was triggered?
Please sign in to leave a comment.
Hi,
The %teamcity.build.triggeredBy% parameter contains information on how it was triggered.
While processing it differently within the same might work for you, you might want to consider whether having two separate configurations which require different processing would make more sense. That way you could restrict each kind of processing to a build configuration that you already know how was triggered, and you would also have separate places to check manual builds and scheduled ones, instead of having to go through the build results to identify each one.
Awesome, thanks! I got it to work with this parameter.
Although I understand your remarks about splitting the build configurations, for our workflow it actually makes sense to keep them as a single build step, which can be triggered in different ways. The difference in handling is also very, very minor.
Thanks!