我的spring boot应用程序在云构建中运行良好,并且部署到9月都没有任何问题。 现在,我的触发器在gcloud应用程序部署中失败。
步骤4:错误:(gcloud.app.deploy)INVALID_ARGUMENT:部署无法使用预构建的映像。只能在App Engine灵活环境中使用预构建的图像。
app.yaml
runtime: java11
env: standard
service: service
handlers:
- url: /.*
script: this field is required, but ignored
cloudbuild.yaml
steps:
# backend deployment
# Step 1:
- name: maven:3-jdk-14
entrypoint: mvn
dir: 'service'
args: ["test"]
# Step 2:
- name: maven:3-jdk-14
entrypoint: mvn
dir: 'service'
args: ["clean", "install", "-Dmaven.test.skip=true"]
# Step 3:
- name: docker
dir: 'service'
args: ["build", "-t", "gcr.io/service-base/base", "."]
# Step 4:
- name: "gcr.io/cloud-builders/docker"
args: ["push", "gcr.io/service-base/base"]
# Step 5:
- name: 'gcr.io/cloud-builders/gcloud'
dir: 'service/src/main/appengine'
args: ['app', 'deploy', "--image-url=gcr.io/service-base/base"]
timeout: "30m0s"
# Step 6:
# dispatch.yaml deployment
- name: "gcr.io/cloud-builders/gcloud"
dir: 'service/src/main/appengine'
args: ["app", "deploy", "dispatch.yaml"]
timeout: "30m0s"
timeout: "100m0s"
images: ["gcr.io/service-base/base"]
先谢谢了。我很困惑我的构建之前如何正常工作以及我现在在做错什么。
答案 0 :(得分:1)
您无法在App Engine标准上部署自定义容器。您必须提供代码和环境运行时。然后使用Buildpack在Google Side 上创建一个标准容器(有关信息,为此运行了一个新的Cloud Build作业),并将其部署在App Engine上。
我建议您看一下Cloud Run以使用您的自定义容器。它非常接近App Engine(在很多方面甚至更好!)并且非常可定制。
答案 1 :(得分:0)
您的cloudbuild.yaml
注释所指的Step 5
对应于错误中的Step #4
,因为系统开始从0开始编号。
错误消息是正确的; App Engine标准(!)与App Engine flexible的不同之处在于后者(flexible)允许容器映像部署。来自来源的App Engine标准deploys
。
请参阅Google的example。
可能是某些原因改变了导致问题的Google一方,但是env: standard
中的app.yaml
提示构建文件已更改。