【发布时间】:2019-06-09 22:29:59
【问题描述】:
总体目标:
我们希望能够使用 Circle CI 作业中的 Docker 容器将工件上传到 Google Cloud 中的存储桶。理想情况下,我们可以使用gsutil cp <artifact> <bucket>
问题:
我最难以自动方式验证gcloud 服务帐户,而且我在任何地方都找不到这方面的文档。几乎我读过的每一篇文章都让你遵循以下两种变体之一:
-
使用
gsutil配置$ gsutil config -a但是,这会提示一系列需要与 shell 交互的问题:
Backing up existing config file "/Users/<user>/.boto" to "/Users/<user>/.boto.bak"... This command will create a boto config file at /Users/<user>/.boto containing your credentials, based on your responses to the following questions. What is your google access key ID? -
使用
gcloud登录:$ gcloud auth login Your browser has been opened to visit: https://accounts.google.com/o/oauth2/auth?....
由于这里的最终结果是 Docker 容器将验证服务帐户以执行gsutil cp,因此交互式登录不是很有利...
我在 this example 中设置了凭据 JSON,但设置环境变量 GOOGLE_APPLICATION_CREDENTIALS 仍然 提示无法自动绕过的 Are you sure? [Y/n] 消息。有什么想法吗?
【问题讨论】:
标签: google-cloud-platform gcloud gsutil