How to share a variable between two build configurations (Mac OS X build agent)

Hi! 

I am trying to share a variable between two build configurations via the well-known method: 

echo "##teamcity[setParameter name='env.SomeVar' value='${variableValue}']"

or 

echo "##teamcity[setParameter name='env.SomeVar' value='$variableValue']"

When the build for this configuration runs on our Mac OS X build agent, I can see in the log that the ##teamcity command is invoked (light gray font - I also see the value inside the "variableValue" variable), but the Environment Parameter on the project level (or on the configuration level) is never updated.

 

The build step is configured as a Command-Line runner.

We are running TeamCity Enterprise 2018.2.2 (build 61245).

 

Any suggestions would be greatly appreciated!

0
2 comments
Avatar
Permanently deleted user

Figured out that service messages are not useful to update Project parameters.  I had to use curl to post the new variable value to the TeamCity API.  

0

Hi,

 

Just to confirm, setting parameters during a build sets them for the specific build, but they are untouched for the build configuration, which means that further runs of that build will keep the initial one. If you want to modify it at the build configuration/project level, you will need to use the REST API.

 

If there are dependencies between the builds you can use dependency parameters to reference them as well.

0

Please sign in to leave a comment.