Share dynamically defined variable between build configurations



is it possible to read a value of some parameter/variable in build step A of build configuration B which was set (I mean the variable) in build step X of build configuration Y of same project in the same (build) run? If yes, how?

Thanks in advance.

Regards, Gabriel

Comment actions Permalink

Hello Gabriel,

It's possibly to read property value if build configuration depends on (snapshot or artifact) from other build configuration. For more details see the section

Also you can use REST API to get build parameters.

Comment actions Permalink

Hi Alina,

thanks for your comment. After reading the mentioned articles I came to a wonderful solution, which I wanted to achieve:

If I set an environment variable in Command Line of Build_Step_A of Build_Configuration_B of project_C in build run Z like:

echo "##teamcity[setParameter name='env.VAR_NAME' value='VAR_VALUE']"

then I can reference that variable in Command Line of Build_Step_X of Build_Configuration_Y of same project_C in the same build run Z as

%dep.<ID of Build_Configuration_B>.env.VAR_NAME%

This solution is working also if I do not add/configure beforehand the mentioned env variable (VAR_NAME)  in the "Parameters" settings of Build_Configuration_B.

Thanks. Regards,


Comment actions Permalink

How i can share variable between Build Steps, not configurations?

Comment actions Permalink

Similar, define variable in build step as environment variable (Runner type: Command Line):
echo "##teamcity[setParameter name='env.VAR_NAME' value='VAR_VALUE']"

then use it in other build step:

This is how I am using, maybe exist an another way, but I am not teamcity expert :-) .

Comment actions Permalink

Gabriel, the solution referring to the dependent builds  works beautiful! thx!


Please sign in to leave a comment.