12

I have a TeamCity build configuration A and B, where B is dependent on A. I need to pass a parameter from B to A when B is triggered.

This is related to question: Override dependencies properties by parameters value in TeamCity 9

and the teamcity documentation here

I need to find WHERE/HOW to use this reverse.dep to set the parameter in the dependent build? In the Project Configuration Parameters section, I can add Configuration/Environment/build parameters, but they take a Name/Value pair. So, pardon my ignorance here, but am not able to make out where to specify this reverse logic.

Thanks

Community
  • 1
  • 1
sppc42
  • 2,994
  • 2
  • 31
  • 49
  • So A depends on something passing a parameter to it? It seems these two are mutually dependent on each other, why not have 1 build configuration that builds them both? – Lasse V. Karlsen Jun 16 '16 at 11:02
  • 1
    @LasseV.Karlsen: A can be build independently also, where that parameter is a Prompt parameter entered by the user. When Running B though, it then needs to pass/set this parameter in A – sppc42 Jun 16 '16 at 11:18

2 Answers2

15

Found it!

We just need to add a new Configuration Parameter in B with name as reverse.dep.<btId>.paramName and its value as the intended value that needs to be passed.

Imp: As noted in the TeamCity documentation -

As the parameter's values should be known at that stage, they can only be defined either as build configuration parameters or in the custom build dialog.

mrucci
  • 4,342
  • 3
  • 33
  • 35
sppc42
  • 2,994
  • 2
  • 31
  • 49
1

you have to use this argument reverse.dep.*.<parameterName> into your build configuration to be consumed by the dependent builds.

for instance, if A depends on B, so if you trigger B and you want to use parameter defined in B into A, then simply add new parameter with name "reverse.dep.*.<parameterName>" Value: <Value> in Configuration Parameters of B and then you can use this parameter with %parameterName% into A build CLI or anywhere.

karan kural
  • 25
  • 1
  • 1
  • 5