Teamcity: Pass Environment parameter to dependent build

build-process, continuous-integration, teamcity

Solution

Each build configuration has a configuration code i.e. bt123 Let's say your Root configuration has the code, bt123, and has a variable called java_dir

Your Sub configuration, can reference it like this

Name: JAVA_DIR Value: %dep.bt123.env.JAVA_DIR%

The easiest way to do this, is to select the small box with lines in the right of the text field, "Value". This will provide a drop list where you should be able to find the variable from bt123.. Just start by typing bt123, and you will see all the variables available.

Hope this helps.

Here is a link to the version 10 documentation regarding dependency properties.

https://confluence.jetbrains.com/display/TCD10/Predefined+Build+Parameters#PredefinedBuildParameters-DependenciesProperties

These options have been available since at least TeamCity 8.x.

Problem

I use two build configurations. - Root - Sub The buildfile for 'Sub' requires a environment parameter 'Param' to run. Can I pass this parameter from my 'Root' configuration to the 'Sub' configuration in Teamcity.

Original source