Run build dynamically from another build
Completed
Hi,
I have a need that I think is not doable via chained builds.
My need:
* a developer start a build A
* build A will retrieve a list of values
* build A will run 1 (another) build B for each item of the list (with the value as parameter)
* Each build B will run a build C, passing the value as parameter, plus an artifact
Since B builds are dynamic (there can be 0 or dozens) and the values can have 10000+ value, I cannot see how to do that in TC.
Is there a way?
Please sign in to leave a comment.
Could you please clarify what do you mean by "Since B builds are dynamic (there can be 0 or dozens) and the values can have 10000+ value"? Is there only one value for each parameter or a set of them?
If I understood your request correctly, you may want to use a script calling REST API to trigger those builds. Here's an article about triggering a build with help of REST API: https://www.jetbrains.com/help/teamcity/rest-api.html#RESTAPI-TriggeringaBuild.
For instance, you can trigger the build A, which has a "custom script" build step in it. You can then iterate through this list of values with the script and trigger the build B for each of them. You can pass those values as parameters for build B, but first you will have to configure such a parameter for build B. The same goes for build C: you can iterate through your list of parameters and call the build C for each of them, passing a value from this list into a pre-configured parameter of build C as you do. Build C could be configured artifact-dependent on build B, in order to pass an artifact from B to C.
In case you'd like to generate multiple parameters for a build on the fly, you should consider sending them as a parsable string (such as json) into a single pre-configured parameter. This is because you need to know a parameter name in order to use it in your script.
Hi Mikhail,
build B would have 1 parameter that can takes 10000 different values.
I can do that via rest api indeed, if there is no way to do that in "standard configuration".
Thanks for the reply.