Pass down parameters in composite build
Hi everyone,
I have a composite build named S
This composite build has one artifact dependency (from build A) (this builds my product), and 4 snapshot dependencies (B, C, D, E) (those are testing my product))
B, C, D, E all have a snapshot and artifact dependency on build A too, since they're testing it.
This works fine, as when I trigger on build on S, first it builds A, then B/C/D/E in parallel, then aggregates everything in S.
In summary, this looks like this :

Now my issue is :
I added a prompt select parameter in S named “test_options” that allows our users to chose which test build they want to perform (B, C, D and / or E)
How do I access this “test_options” parameter in B/C/D/E, or even A, so I can make a condition to execute or not the various build steps ?
I tried playing with overriding parameters (see this post), but I don't want to override it, I just want to access the value to make a condition on it.
Thanks !
Please sign in to leave a comment.
Hi! To pass a parameter value from S to upstream builds, add the
reverse.dep.*.
prefix to your parameter name, for example:reverse.dep.*.required_dependencies
. This will set therequired_dependencies
parameter in all upstream builds (A, B, C, D, and E) to the specified value. In the build steps of those configurations, you can add an execution condition like "required_dependencies contains B". The step will only run if B is contained within the parameter value %required_dependencies%.Related docs:
https://www.jetbrains.com/help/teamcity/use-parameters-in-build-chains.html#Override+Parameters+of+Preceding+Configurations
https://www.jetbrains.com/help/teamcity/build-step-execution-conditions.htmlAlso, you may want to watch for the optional dependencies feature that is currently in the works:
https://youtrack.jetbrains.com/issue/TW-65341/Execute-a-dependency-basing-on-condition
Works perfectly, thank you so much !
Seems like I didn't quite understand how reverse parameters work.
Thanks for the upcoming feature, i'll keep an eye on it, it will help remove all conditions in my build steps.
Hi Antoly,
If I can I want to continue this topic, it's my first time doing a composite build,
I have a main build (composite) and two separate ones for two platforms, let's call them A and I
In the main build both subbuilds are added to Snapshot Dependencies, now how should I use reverse.dep.* correctly as I don't fully understand it?
I understand that it should be added in place of the code of steps in builds A and I, which should inherit these parameters from the main build? Is there something I don't quite understand correctly?
Let's say you have a build chain of two builds: BuildA and BuildB. BuildB has a snapshot dependency on BuildA, so when BuildB is triggered, it triggers BuildA, waits for it to finish, and then BuildB runs.
BuildA has a parameter `ParameterA`, you want this parameter to be defined when the BuildB is triggered, i.e., you want BuildB (which is executed after BuildA) to define the parameter used in BuildA.
To do this, you define a parameter `reverse.dep.<BuildA_ID>.ParameterA` in BuildB and set its value there. BuildA then will use this value in `ParameterA` parameter. Please note that `<BuildA_ID>` is the build configuration's ID, not the build configuration's name.
Please refer to https://www.jetbrains.com/help/teamcity/2024.07/use-parameters-in-build-chains.html#Override+Parameters+of+Preceding+Configurations.
And the other way, If you have a build chain BuildA > BuildB, i.e., BuildB has a dependency on BuildA, and BuildA has a parameter `ParameterA` which you need to access from BuildB, you should use `dep.<BuildA_ID>.ParameterA` to access it. Please note that you need to use the build configuration's ID, not the build configuration's name. Please refer to https://www.jetbrains.com/help/teamcity/2024.07/use-parameters-in-build-chains.html#Access+Parameters+of+Preceding+Chain+Builds.
I hope this helps with your questions and understanding of working with parameters of dependencies.
Best regards,
Anton
So in this situation if I want to inherit form main build (on right side) to this on left side (on bottom) I should using dep, not reverse
The dependent build that is being executed (the two on the left) does not have certain parameters after the main build, e.g. env.XYZ value %BuildVersion% e.g.
Generally, when I run a build outside the chain, everything works fine, but when I run the build from the main build level, the entire chain is missing a lot of information (dependent build)
This also applies to passwords etc
Let's say, the build on the left has a ParameterA defined. To pass the value to it when triggering the build on the right, the build on the right should have the reverse.dep.<LeftBuild_ID>.ParameterA parameter defined. The value of this parameter will be passed to ParameterA on the left build. Please note to use build configuration's ID, not the build configuration's name.
Please refer to https://www.jetbrains.com/help/teamcity/2024.07/use-parameters-in-build-chains.html#Override+Parameters+of+Preceding+Configurations.
Best regards,
Anton