简体   繁体   English

为什么 AppEngine 部署会因构建失败而失败?

[英]Why would an AppEngine deploy fail with a build failure?

I started working on an app and suddenly it fails to deploy to appengine, with the following error message:我开始开发一个应用程序,但突然无法部署到应用程序引擎,并显示以下错误消息:

siim@pebble:~/projects/xyz$ gcloud app deploy
Services to deploy:

descriptor:                  [/home/siim/projects/xyz/app.yaml]
source:                      [/home/siim/projects/xyz]
target project:              [xyz]
target service:              [default]
target version:              [20220313t182940]
target url:                  [https://xyz.uc.r.appspot.com]
target service account:      [App Engine default service account]


Do you want to continue (Y/n)?  y

Beginning deployment of service [default]...
╔════════════════════════════════════════════════════════════╗
╠═ Uploading 2 files to Google Cloud Storage                ═╣
╚════════════════════════════════════════════════════════════╝
File upload done.
Updating service [default]...failed.                                                                                                                    
ERROR: (gcloud.app.deploy) Error Response: [9] Cloud build 016c4604-6ea6-47df-8144-e7f1471c6df6 status: FAILURE
removing /layers/google.go.gomod/gopath: unlinkat /layers/google.go.gomod/gopath/pkg/mod/github.com/golang/protobuf@v1.3.1/regenerate.sh: permission denied
Full build logs: https://console.cloud.google.com/cloud-build/builds;region=us-central1/016c4604-6ea6-47df-8144-e7f1471c6df6?project=576574664421

Clicking through to the build log, I see:单击构建日志,我看到:

===> DETECTING
google.go.appengine_gomod 0.9.0
google.go.gomod           0.9.0
google.go.build           0.9.0
google.go.appengine       0.9.0
google.utils.label        0.0.2
===> ANALYZING
Previous image with name "us.gcr.io/xyz/app-engine-tmp/app/default/ttl-18h:69af35b6-6fc6-4167-88f3-da16f9cfc7e7" not found
Restoring metadata for "google.go.gomod:gopath" from cache
===> RESTORING
Restoring data for "google.go.gomod:gopath" from cache
===> BUILDING
=== App Engine Gomod (google.go.appengine_gomod@0.9.0) ===
--------------------------------------------------------------------------------
Running "cp --dereference -R . /layers/google.go.appengine_gomod/srv"
Done "cp --dereference -R . /layers/google.go.appengine_gomod/srv" (53.220262ms)
=== Go - Gomod (google.go.gomod@0.9.0) ===
DEBUG: go.mod SHA has changed: clearing GOPATH layer's cache
Failure: (ID: f51775d1) removing /layers/google.go.gomod/gopath: unlinkat /layers/google.go.gomod/gopath/pkg/mod/github.com/golang/protobuf@v1.3.1/regenerate.sh: permission denied
--------------------------------------------------------------------------------
Running "mv -f /builder/outputs/output-5577006791947779410 /builder/outputs/output"
Done "mv -f /builder/outputs/output-5577006791947779410 /builder/o..." (5.980458ms)
ERROR: failed to build: exit status 1

I'm completely mystified by this.我对此完全迷惑了。 AFAICT this is something AppEngine does internally so I don't think I have any way to debug this further? AFAICT 这是 AppEngine 在内部做的事情,所以我认为我没有办法进一步调试它? FWIW, my app is super simple ATM: FWIW,我的应用程序是超级简单的 ATM:

module xyz

go 1.17

require (
        github.com/go-chi/chi/v5 v5.0.7
        go.etcd.io/bbolt v1.3.6
        google.golang.org/appengine/v2 v2.0.1
)

require (
        github.com/golang/protobuf v1.3.1 // indirect
        golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d // indirect
)

And:和:

runtime: go116
main: ./cmd/server

The solution was to go to container registry (maybe artifact registry soon) in the cloud console and delete all the containers there.解决方案是将 go 发送到云控制台中的容器注册表(可能很快就会成为工件注册表)并删除那里的所有容器。 The issue was quite likely just one of those images (maybe the build cache one) but my app is not released so I could just delete all of them.问题很可能只是其中一张图片(可能是构建缓存图片),但我的应用程序尚未发布,因此我可以删除所有图片。

I resolve it using --no-cache option, but its not perfect because cache is not enabled.我使用 --no-cache 选项解决了它,但它并不完美,因为未启用缓存。

$ gcloud app deploy app.yaml --no-cache

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM