1

我需要能够从 linux gocd 代理更新环境变量。应该可以从代理上运行的任何管道中访问此环境变量。到目前为止,我阅读的文档讨论了使用在 gocd 环境中创建的环境变量。然而,这不是我的要求。

到目前为止,我已经尝试了以下步骤:

 - Logged into the agent as go user and set an environment variable ( export VARA=XXX)
 - Tried to echo this variable from a pipeline in gocd that prints this variable, in vain.
 - Also tried specifying the variable in bash_profile, bashrc and executed the source command in the same gocd task that echoes the variable 

出于某种原因,gocd 管道似乎没有看到这个变量。如果您有任何指示,请告诉我。

4

1 回答 1

1

如果将变量放在~/.bash_profileor~.bashrc文件中,则可以将实际命令包装在bash -l -c 'your command here. -l强制 bash 充当登录 shell,并读取这些文件。

于 2017-11-28T19:43:28.337 回答