How to pass environment parameters to dependency builds

Answered

Hi all,

I have two build configurations, A and B, where A depends on B. I'm trying to pass an environment parameter from A to B using the reverse dependency technique outlined in the docs: https://confluence.jetbrains.com/display/TCD9/Predefined+Build+Parameters#PredefinedBuildParameters-OverridingDependenciesProperties

 

For some reason, my parameter in configuration B always ends up unresolved. This is the output as configuration B starts to build:

Parameter "env.change=%env.change%" is not fully resolved, using as is.

Here is the parameter configuration for A:

and build B:

I'm not sure what I am missing from the documentation. It seems like I'm successfully passing %env.change%, but the variable is not being resolved in time for the build. Any hints would be greatly appreciated! Thanks!

0
1 comment

Hello!

Unfortunately, the current implementation does not allow to resolve the parameters in the context of A build (please see the related issue here: https://youtrack.jetbrains.com/issue/TW-42994). Please feel free to vote/comment for it as you see fit.

Speaking of a workaround; while running the build from UI indeed will not allow to pass a reverse.dep.* parameter referencing another parameter in context of A, you could start a build via REST API and pass already cooked value as a reverse.dep.* parameter. For example, this request:

[POST] <TeamCity URL>/app/rest/buildQueue

<build> <buildType id="buildConfID"/> <properties> <property name="reverse.dep.*.env.change" value="cooked_value"/> </properties> </build>

will start a new build under buildConfID configuration with reverse.dep.*.env.change parameter set to cooked_value, and it will be properly passed to the dependency builds. You could have a "starter" build configuration which would consist of a single command line step to invoke above request, and it would start build A (and the rest of the chain). I have to agree that while REST API usage allows for a better flexibility across the board (not just for this specific case), having a separate starter or other external launcher introduces additional overhead, though.

Please find general details on how to use REST API here: https://www.jetbrains.com/help/teamcity/rest-api.html.
If there is anything I can look into or assist with, please let me know.

0

Please sign in to leave a comment.