如何在 Unix TeamCity 构建代理上设置环境变量 PATH 和 LD_LIBRARY_PATH?
我使用 TeamCity 在 Unix (Solaris) 上构建 C++。 TeamCity 调用 make,并且在我的 makefile 中我需要调用 svn。为此,我需要修改 PATH
和 LD_LIBRARY_PATH
。
我可以在 makefile 中设置它们,但位置因服务器而异。有谁知道为每个 TeamCity 构建代理设置这些的方法,例如通过编辑 conf/buildAgent.properties
?
我可以在 TeamCity 构建帐户的 ~/.login
等中设置它们,但我不希望这样做,因为它是共享帐户。
-谢谢,巴尼
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以按照您的预期,通过设置以
env.
开头的属性,在conf/buildAgent.properties
中配置环境。它适用于从头开始设置变量和修改现有值。我的看起来像这样:(隐藏在文档中. 我不确定 5.0 是否有这个(不过我认为有),但 7.0 肯定有。)
You can configure the environment in
conf/buildAgent.properties
as you suspected, by setting properties that begin withenv.
. It works for both setting variables from scratch and modifying existing values. Mine looks like this:(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.)
您可以创建一个包装器脚本,在执行 TeamCity 命令之前导出这些变量。
You could create a wrapper script that exports these variables before executing the TeamCity command.