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
Edit page. Last modified: 17 October 2022. Build parameters are name-value pairs, defined by a user or provided by TeamCity, which can be used in a build. They help flexibly share settings and pass them to build steps.
In Java, we can get currently running teamcity build number as follows: String tc_BuildNumber = System. getenv("BUILD_NUMBER"); This is because TC provides an environment variable namely BUILD_NUMBER.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With