0
votes

I have a Job A and Job B in teamcity, Job B is a dependency for Job A(continuous build and deployment job). I use/pick the parameters channels, environment and branch in both the jobs during the build trigger. So when I trigger the build for Job A I select these parameters but these values are not been pickedup in Job B.

Can some one please help me on how to pass these parameters into the dependency jobs.

2

2 Answers

1
votes

You should use dep.<btID>.<property name> format to get the property from the dependent build (see Dependencies Properties for details).

So in case job A depends on job B and job B has id jobB, you might use %dep.jobB.paramaterName% reference to get parameterName parameter from job B.

Update

Since TeamCity 9.0 there is a possibility to redefine parameters in dependency builds. You should use reverse.dep.<btID>.<property name> format, as described here

E.g.: if job A has parameter called reverse.dep.jobB.param (defined either as build configuration parameters or in the custom build dialog), job B can use it as param called param.

0
votes

I use an initializing job (we'll call it Job C) that becomes a dependency for the other builds. It doesn't do much besides set common parameters for the downstream builds. Job B and Job A both have Job C as a dependency, in addition to the dependency of Job A on Job B. This also lets you cascade the same branch through several different downstream build configurations and keep Job A and Job B on the same build number (using %dep.x.build.number% as cyberskunk described) if you so desire.

The downside is you will have to trigger the build from Job C if you want any custom parameters to trickle through. It's not a problem for my use case.