应用引擎的 Jenkins 推送部署设置失败

Jenkins push-to-deploy setup for app-engine fails

我从 bitnami-jenkins 图像创建了一个新的计算引擎实例来自动部署我的应用程序引擎应用程序。我使用以下命令来执行此操作:

gcloud compute instances create deployer
--project myapp --image-project bitnami-launchpad
--image bitnami-jenkins-1-638-1-linux-debian-7-x86-64
--zone us-central1-a --machine-type g1-small 
--metadata "bitnami-base-password=mypassword,bitnami-default-user=user,bitnami-key=jenkins,bitnami-name=Jenkins,bitnami-url=//bitnami.com/stack/jenkins,bitnami-description=Jenkins,startup-script-url=https://dl.google.com/dl/jenkins/p2dsetup/setup-script.sh" 
--scopes "https://www.googleapis.com/auth/userinfo.email,https://www.googleapis.com/auth/devstorage.full_control,https://www.googleapis.com/auth/projecthosting,https://www.googleapis.com/auth/appengine.admin" 
--tags "jenkins"

创建机器后,我创建了一个作业来部署代码,如下所述:

https://cloud.google.com/tools/cloud-repositories/docs/push-to-deploy

但是,我的作业因以下错误而失败:

ERROR: Error Response: [403] Request had insufficient authentication scopes.
ERROR: (gcloud.preview.app.deploy) Could not retrieve the default Google Cloud Storage bucket for [myapp]. Please try again or use the [bucket] argument.

有其他人遇到过这个吗?我有另一台带有旧版本 gcloud 的 jenkins 机器。它从未抛出任何与云存储桶相关的错误。所以我有一种预感,它与较新版本的gcloud有关。

请帮忙。谢谢。

编辑:这里是带有 --verbosity debug 的 gcloud 命令的输出。 gcloud output

这个答案具有误导性;它错误地识别了真正的问题。为了后代,我把它留在这里。


这看起来像是 Google Compute Engine 服务帐户和 Google 云存储桶之间的交互问题。

要变通,请create a Cloud Storage bucket that the service account on the Jenkins VM can read from/write to, or change the permissions on the Cloud Storage bucket staging.<appname>.appspot.com. The easiest place to do that will be the Google Developer's Console, if you're not familiar with gsutil(执行此操作的命令行工具)。


So I have a hunch that it is related to newer versions of gcloud.

是的,是的。 gcloud 的新版本使用不同的部署机制(速度会更快)。

当我尝试使用最新版本的 Cloud SDK (0.9.88) 重现此内容时,我收到以下错误消息:

ERROR: (gcloud.preview.app.deploy) Required scopes ['https://www.googleapis.com/auth/cloud-platform'] missing from ['https://www.googleapis.com/auth/appengine.admin', 'https://www.googleapis.com/auth/devstorage.full_control', 'https://www.googleapis.com/auth/projecthosting', 'https://www.googleapis.com/auth/userinfo.email']. This VM instance probably needs to be recreated with the missing scopes.

解决方案是像以前一样重新创建 VM,但是 将范围 https://www.googleapis.com/auth/cloud-platform 添加到 --scopes 标志中提供的列表中 https://www.googleapis.com/auth/cloud-platform

我会确保修复文档以反映这一点。 编辑:文档现已修复。