Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Teamcity: Pass Environment parameter to dependent build

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.

like image 859
crauscher Avatar asked Feb 17 '10 09:02

crauscher


People also ask

How do I add parameters to TeamCity?

In the build number pattern or VCS labeling pattern, you can use the %<prefix>. parameter_name% syntax to reference any parameter known by TeamCity: Predefined parameters of a server or build configuration. Custom build parameters added on the Build Configuration Settings | Parameters page.

What is snapshot dependency in TeamCity?

By setting a snapshot dependency of a build (for example, build B) on another build's (build A) sources, you can ensure that build B will start only after build A is run and finished. We call build A a dependency build, whereas build B is a dependent build.

How do I change my TeamCity build number?

Go to the General Settings of the build configuration. Click the orange Show advanced options. Set the Build counter to your desired value. Set the Build number format to %build.

What is checkout directory in TeamCity?

The build checkout directory is a directory on the TeamCity agent machine where all the sources of all builds are checked out into. If you use the agent-side checkout mode, the build agent checks out the sources into this directory before the build.


1 Answers

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.

like image 130
user304133 Avatar answered Sep 28 '22 12:09

user304133