【发布时间】:2019-11-20 08:04:51
【问题描述】:
我应该如何编辑我的 cloudbuild.yaml 文件,以便我可以将多个环境变量作为机密传递?
我已将两个身份验证令牌存储在两个单独的文件中,即 SECRET1.txt 和 SECRET2.txt 在我本地计算机的当前工作目录中。
我想使用 KMS 将这两个身份验证令牌作为机密传递给 Google Cloud Build。
cloudbuild.yaml 文件应该是什么样子才能让 Cloud Build 安全地访问我的令牌?
我尝试使用在这里找到的加密机密 https://cloud.google.com/cloud-build/docs/securing-builds/use-encrypted-secrets-credentials
这是我为 cloudbuild.yaml 尝试过的:
steps:
- name: "gcr.io/cloud-builders/gcloud"
secretEnv: ['SECRET1', 'SECRET2']
timeout: "1600s"
secrets:
- kmsKeyName: projects/<Project-Name>/locations/global/keyRings/<Key-Ring-Name>/cryptoKeys/<Key-Name>
secretEnv:
SECRET1: <encrypted-key-base64 here>
SECRET2: <encrypted-key-base64 here>
我收到此错误消息: Error
Cloud Build 能够读取令牌(我在此处使用 RED 墨水将其删除 Error),但它会输出一条错误消息,指出“错误:ENOENT:没有这样的文件或目录”。
谁能告诉我我的方法出了什么问题以及为什么 Cloud Build 无法访问这些身份验证令牌(秘密)?
【问题讨论】:
-
发布问题时包括结果和错误消息。
标签: node.js google-app-engine google-cloud-platform google-cloud-build