Need help with syntax of environment variables

Hi,

I am having some trouble/confusion with the environment variable syntax for path-like environment variables for both Linux and Windows.  I have been attempting trial-and-error, but without much luck.

For example in Linux, I want to set the path using something like “export PATH=/usr/local/bin;$PATH”.  It should append the existing PATH to the end of my new path string.

Same in Windows, the syntax is “Set PATH = c:\mystuff;%PATH%”

What syntax should I use in TeamCity?  I am having trouble getting things to work.

In addition, how do I handle paths with spaces in them?  Do I need to surround everything with quotes?  I tried this and it does not work, is it single or double quotes?

What if I want to specify a path that includes a TeamCity reference path such as %teamcity.build.workingDir%?  What syntax do I use to include that path in an environment path variable?  Does the inserted variable include the backslash at the end?

I could not find any good examples of this in the documentation, so some help would be appreciated.

2 comments
Comment actions Permalink

Danielle,

If you need to set the environment variable in TeamCity Build Configuration settings, you can set "env.Path" environmentvariable (on step 6:Properties and environment variables) to
/usr/local/bin%system.path.separator%%env.Path%
or
c:\mystuff;%env.Path%

Usually, you do not need any special care for proparties values that contain spaces.

To add path referencing "lib" directory residing in the build checkout directory to path, add "env.Path" property with value:
%system.teamcity.build.checkoutDir%tools/lib%system.path.separator%%env.Path%

For documentation describing the properties handling in TeamCity, please refer to the seciton.

0
Comment actions Permalink

You answer was very close.  I needed to add the system.file.separator after the system.teamcity.build.checkoutDir.  Otherwise I was still getting an error.

env.PYPHONPATH=%system.teamcity.build.checkoutDir%%system.file.separator%Symphony/Tools/BuildTools/src

Thanks,
Danielle

0

Please sign in to leave a comment.