我需要能够从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管道似乎没有看到这个变量 . 如果您有任何指示,请告诉我 .
1 回答
如果将变量放在
~/.bash_profile
或~.bashrc
文件中,则可以将实际命令包装在bash -l -c 'your command here
中 .-l
强制bash表现为登录shell,并读取这些文件 .