Sharing a build environment variable with a dependent build

I am curious if we have 2 builds,  Build A is dependent on Build B,   We set an environment variable in Build A (ie, past.buildnumber), if we can use that environment variable in the dependent build B?

We have an environment deploy build that takes the past.buildnumber (checked into svn) and needs to execute dependent build B (DB Update build) and use the same past.buildnumber.

I have tried using %past.buildnumber% as the build for build A (bt12) and then having the buildnumber format in Build B and it doesnt seem to work.

Comment actions Permalink

also the agents running the 2 different builds are running on 2 different machines.  This may change things.

Comment actions Permalink


For now, TeamCity does not provide the ability to "return" custom values from the build to the server to be reused in later builds. Using the "dep." syntax you can only reference server build properties and the properties entered on the build run in the custom build run dialog.

We have a feature request for the feature you describe:TW-5294. After its implementation it will be possible to tell TeamCity a value to remember from within the build script and further builds up the build chain will be able to use the value using "dep." syntax. Please vote/watch for the issue.

A workaround is to put the value inside the build artifacts and then get the artifact and parse the value in the dependent build using TeamCity artifact dependency.

Best regards,

Yegor Yarko
Project Manager (TeamCity)
JetBrains, Inc
"Develop with pleasure!"


Please sign in to leave a comment.