How can I set environment variables PATH and LD_LIBRARY_PATH on Unix TeamCity build agent?
Asked Answered
B

2

5

I use TeamCity to build c++ on Unix (Solaris). TeamCity invokes make, and within my makefile I need to call svn. For this I need to modify PATH and LD_LIBRARY_PATH.

I could set these within the makefile but the locations vary from server to server. does anyone know a way to set these for each TeamCity build agent, e.g. by editing conf/buildAgent.properties?

I could set them in ~/.login etc for the TeamCity build account, but I would prefer not to as it is a shared account.

-thanks, Barney

Broaden answered 3/11, 2010 at 17:57 Comment(0)
A
0

You could create a wrapper script that exports these variables before executing the TeamCity command.

Arching answered 11/4, 2011 at 14:35 Comment(1)
Yes I think this is the only option - I was hoping for per-server config in the per-server config file, but this works.Broaden
T
19

You can configure the environment in conf/buildAgent.properties as you suspected, by setting properties that begin with env.. It works for both setting variables from scratch and modifying existing values. Mine looks like this:

env.MAKEFLAGS=-j8
env.PATH=/usr/local/bin:%env.PATH%

(It's hidden in the docs. I'm not sure if 5.0 had this (I think it did, though), but 7.0 definitely does.)

Tavey answered 8/6, 2012 at 8:38 Comment(0)
A
0

You could create a wrapper script that exports these variables before executing the TeamCity command.

Arching answered 11/4, 2011 at 14:35 Comment(1)
Yes I think this is the only option - I was hoping for per-server config in the per-server config file, but this works.Broaden

© 2022 - 2024 — McMap. All rights reserved.