如何更新或添加环境变量到 TeamCity 代理 [英] How to update or add an Environment Variable to a TeamCity agent

查看:56
本文介绍了如何更新或添加环境变量到 TeamCity 代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

TeamCity 代理在代理参数下显示环境变量"列表,但我无法让它们更新.我已将环境变量添加到我的代理操作系统,但无法让它们刷新.我已经尝试重新启动代理并禁用和重新启用代理.

TeamCity agent's show a list of "Environment Variables" under Agent Parameters but I cannot get them to update. I've added environment variables to my agent operating system, but cannot get them to refresh. I've tried restarting the agent and disabling and re-enabling the agent.

推荐答案

TeamCity 代理实际上并不从操作系统读取环境变量.相反,它从您的代理机器上的 buildAgent/conf/buildAgent.properties 文件中读取它们.在此文件的底部,您将看到有关如何添加新变量的说明.像这样:

The TeamCity agent doesn't actually read environment vars from the OS. Instead it reads them from the buildAgent/conf/buildAgent.properties file on your agent machine. Down at the bottom of this file you'll see instructions on how to add new variables. Something like this:

# Environment Variables
#env.exampleEnvVar=example Env Value
env.GRADLE_HOME=/Frameworks/gradle-2.9

完成此操作后,切换到代理计算机上的命令提示符,然后执行如下操作:

Once you'ce done this switch to command prompt on your agent machine, and execute something like this:

./agent.sh stop
./agent.sh start

显然依赖于操作系统.那里有一个适用于 Windows 的 .bat 文件.

Obviously OS dependant. There is a .bat file there for Windows.

这应该会让您的环境变量显示在 TeamCity 中.

That should get your Environment variables showing up in TeamCity.

这篇关于如何更新或添加环境变量到 TeamCity 代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆