Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Override dependencies properties by parameters value in TeamCity 9

In TeamCity 9 I have two build configurations: A, B which depends on A (snapshot dependency). Sometimes A starts alone, sometimes in chain with B. I want to change build.number of A to (for example) 0.<build.counter of B> when A triggered by B.

According to docs:

Since TeamCity 9.0, there is a possibility to override the dependencies parameters by redefining them in the dependent build. For example, build configuration A depends on B and B depends on C; A has the ability to change parameters in any of its dependencies using the following format:

reverse.dep.<btID>.<property name>

Ok, I created configuration parameter in B: reverse.dep.A.build.number=0.%build.counter%. So, when I start the build chain I suppose build.number of A will changed to 0.123 (for example, build.counter of B equal to 123), but instead the string 0.%build.counter% has been passed to A and A uses own property build.counter.

How to pass exactly values of TeamCity parameters?

like image 433
Gendolph Avatar asked Apr 22 '15 10:04

Gendolph


1 Answers

By the time "A" build starts, the "B" build is still in queue and so there is no build number available. The %build.number% parameter could not be resolved and was passed literally.

Try creating the "C" configuration and add a snapshot dependency on it (from both A and B). Set build number format in both A and B to %dep.C.system.build.number% This way you will have A and B share same counter.

like image 68
Nikita Skvortsov Avatar answered Oct 08 '22 13:10

Nikita Skvortsov