【问题标题】:Setting an env variable accessible to the gocd pipeline设置 gocd 管道可访问的环境变量
【发布时间】:2017-11-29 03:43:28
【问题描述】:

我需要能够从 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 管道似乎没有看到这个变量。如果您有任何指示,请告诉我。

【问题讨论】:

    标签: go-cd


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-09-30
      • 1970-01-01
      • 2017-08-09
      • 2021-04-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多