Seeking for help with setup multiple trigger for a failed configurations
Hello,
Please, I am wondering if there is a simple way how to trigger multiple configurations in the TC.
We have multiple configurations with tests that are triggered based on dependencies, once a dependency/build is finished successfully, tests are automatically triggered too.
But sometimes the configurations with tests fails due to a various reasons.
And I would like to create another single configuration that will be able to re-run only those that failed (but dependency has not be touched)
Is there a simple way how to achieve that ?
I need to do that in Kotlin DSL.
Structure in the TC looks like:

Please sign in to leave a comment.
Would Retry Build Trigger (https://www.jetbrains.com/help/teamcity/2024.03/configuring-retry-build-trigger.html) work for you? Please try it out, and if it is not what you are looking for, please provide the details of the desired behavior.
Best regards,
Anton
Hi,
Thanks for the advice.
I'm looking to implement a workflow where I can manually trigger builds for all configurations at once, rather than having them triggered automatically. Ideally, I want a single configuration that triggers all subprojects under it, retaining the individual settings of each subproject but with a specific parameter change that will be passed to all subprojects.
Is it possible to achieve this in Kotlin DSL? If so, could you provide some guidance or examples on how to set this up?
Thank you!
You can create a build configuration with the snapshot dependencies set up for all the required configurations: https://www.jetbrains.com/help/teamcity/snapshot-dependencies.html. Triggering this configuration will trigger all the dependencies.
For the most part, Kotlin DSL allows you to set up everything that can be set up in the TeamCity UI, except for a couple of rare exceptions. For the dependencies in the Kotlin DSL, please refer to https://www.jetbrains.com/help/teamcity/kotlin-dsl-documentation/root/dependency/.
Best regards,
Anton
Hello Anton,
Yes, using snapshot dependencies seems to work, but I can't figure out how to change or pass parameters from the single trigger to the snapshot dependencies. Do you know how to do this?
Thank you!
You can use the shared parameters in the build chain as described here: https://www.jetbrains.com/help/teamcity/use-parameters-in-build-chains.html.
You may also take a more unified approach by storing the parameters values as environment variables on the build agent and running the build chain on the same agent: https://www.jetbrains.com/help/teamcity/configuring-build-parameters.html.
Please let me know if it works for you.
Best regards,
Anton
Thank you for the response.
The first approach using shared parameters in the build chain seems more suitable for us, as the second approach won’t work due to our inability to ensure builds run on the same agent.
However, I’m not entirely clear on the example provided in the build chain link:
TAG=v1 docker build -f Dockerfile --tag your.registry/MyApp:${TAG} docker push your.registry/MyApp:v1 echo "##teamcity[setParameter name='DockerImageName' value='MyApp:${TAG}']"
Where should this be added?
We use a default template for all build configurations. Could you guide me on where to put this build step from the example? Additionally, how can I define a simple variable, such as 'Product version,' with a value specified manually in the main configuration, and then pass this variable to the snapshot dependencies using the provided example? I do not understand exactly what parameters like
TAG
,your.registry/MyApp
, andDockerImageName
mean in this context.Thank you!
In this example, there is a build configuration parameter DockerImageName, which value is set with the following command in the command line build step:
echo "##teamcity[setParameter name='DockerImageName' value='MyApp:${TAG}']"
Then, it may be accessed by the next build configuration in the build chain using the %dep.ConfigA.DockerImageName%.
If the value is static, you can just create a configuration parameter with the set value in the ConfigA and then access it from the next build configurations using %dep.ConfigA.<ParameterName>%.
Best regards,
Anton
Hello Anton,
Do I need to use the line
TAG=v1 docker build -f Dockerfile --tag your.registry/MyApp:${TAG} docker push your.registry/MyApp:v1
in the build step of the build configuration to be able to use `%dep.ConfigA.DockerImageName%` in the build chain, or is the lineecho “##teamcity[setParameter name='DockerImageName' value='MyApp:${TAG}']”
with my own parameter/value sufficient?I am asking because I've already tried this approach and I could not see any parameter that I defined this way in the ConfigA build configuration when I typed `%dep.` in the TeamCity UI to trying to find out, that the params could be really accessed.
Additionally, when you mention a static value, do you mean a value hardcoded in the ConfigA parameters, or does it also include a value set through the UI custom menu in TeamCity?
Best regards,
Josef
Dear Josef,
Could you provide more detail on what is not working for you?
As an example, I created a build parameter in the first build configuration:
And I can access it in subsequent configurations in the build chain:
The documentation shows a real-life example that builds and pushes a Docker image. It saves the name of this image to the
DockerImageName
parameter to use in subsequent build configurations. You don't need to run Docker commands to just save the new value to the created parameter.Best regards,
Anton
Could you please resend the last comment? I can't see any images in it. Thank you!
Best regards,
Anton
Hello Anton,
I figured it out with the help of my colleague. I had initially set up the dependencies in the opposite way, with ConfigA depending on ConfigB, ConfigC, etc., which is why the
%dep.
reference didn't work. I thought I had to set it up with a top-down hierarchy, which led me to assume that the first way was correct.I switched it so that now each subproject (ConfigB, ConfigC, etc.) has dependencies set up to ConfigA. With this setup, the
%dep.
reference is working well.Thank you for your assistance!