Dav*_*vid 5 javascript bitbucket express bitbucket-pipelines
假设 bitbucket 存储库中有一个项目,将秘密 API 密钥存储在配置文件(如 config.json)中:
{
"secret":
}
Run Code Online (Sandbox Code Playgroud)
是否可以从 bitbucket 管道中的变量引用“秘密”变量,然后将其自动部署到 google App Engine,以便 App Engine“知道”秘密变量?
envsubst您可以在管道中使用命令。
您的 json 文件将如下所示并命名为config_template.json:
{
"secret": $SECRET
}
Run Code Online (Sandbox Code Playgroud)
您的管道中的步骤如下所示:
- step:
name: replace secret
script:
# pipe config_template.json to envsubst and store result in a file called config.json
- cat config_template.json | envsubst > config.json
# show config.json TODO: Remove this when you are sure it is working!
- cat config.json
# Deploy config.json to App Engine here!
Run Code Online (Sandbox Code Playgroud)
这假设您envsubst的构建映像中有一个SECRET在管道中调用的存储库变量。
| 归档时间: |
|
| 查看次数: |
4469 次 |
| 最近记录: |