导入外部YAML文件,并将它们用作gitlab中的环境变量
我有一个rest_config.yaml文件,看起来很loke:
host: abcd
apiKey: abcd
secretKey: abcd
我想在.gitlab-ci.yaml文件中导入这些文件,并将它们用作我的环境变量。我该怎么办?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您的yaml文件是gitlab-ci.yaml管道在该存储库中的一部分,则说Pipeline可以在
脚本中读取文件:
部分,为 i在这里说明。该脚本:部分可以设置环境变量。
和您可以在作业之间明确传递变量
If your yaml file is part of the checked out repository on which the gitlab-ci.yaml pipeline operates, said pipeline can read the file in a
script:
section, as I illustrated here.That script: section can set environment variables.
And you can pass variables explicitly between jobs
建造:
阶段:构建
脚本:-var1 = foo
文物:
路径:
测试:
阶段:测试
脚本:
build:
stage: build
script: - VAR1=foo
artifacts:
paths:
test:
stage: test
script: