Google AppEngine - 自动部署到 App Engine 失败
Google AppEngine - Auto deploy to App engine failing
我有一个 Spring 启动应用程序,我想将其自动部署到 App Engine。我不想创建 docker 映像然后部署它。由于 'Cloud SDK not found error'
,构建失败
[ERROR] Failed to execute goal com.google.cloud.tools:appengine-maven-plugin:1.3.2:deploy (default-cli) on project location-finder-rest-api: Execution default-cli of goal com.google.cloud.tools:appengine-maven-plugin:1.3.2:deploy failed: The Google Cloud SDK could not be found in the customary locations and no path was provided.
我遵循了 https://cloud.google.com/source-repositories/docs/quickstart-triggering-builds-with-source-repositories 中的所有指南。
根据文档,app.yaml 文件创建于 src/main/appengine。 app.yaml的内容是
# [START runtime]
runtime: java
env: flex
handlers:
- url: /.*
script: this field is required, but ignored
runtime_config: # Optional
jdk: openjdk8
manual_scaling:
instances: 1
# [END runtime]
为了触发构建,我必须指定 cloudbuild.yaml 文件。该文件的内容是:
steps:
- name: 'gcr.io/cloud-builders/mvn'
args: ['appengine:deploy','-Pprod']
cloud-builder 的官方文档建议使用 'install' 作为 mvn 步骤的参数。但是这一步并没有部署应用程序。
我是否缺少任何配置?
在幕后,appengine:deploy
目标使用 Cloud SDK 实际部署您的应用程序。 gcr.io/cloud-builders/mvn
映像不提供它(每个 Cloud Build 步骤都在其自己的容器中运行)。
您可以使用单独的构建步骤来安装和部署您的应用,例如:
steps:
- name: 'gcr.io/cloud-builders/mvn'
args: ['install']
- name: 'gcr.io/cloud-builders/gcloud'
args: ['app', 'deploy']
它通过对 LundinCast 上面建议的解决方案稍作修改而起作用。此外,appengine maven插件需要更新到2.0.0+。此版本会自动下载必要的依赖项。
steps:
- id: 'Stage app using mvn appengine plugin on mvn cloud build image'
name: 'gcr.io/cloud-builders/mvn'
args: ['package', 'appengine:stage', '-Pprod']
- id: "Deploy to app engine using gcloud image"
name: 'gcr.io/cloud-builders/gcloud'
args: ['app', 'deploy', 'target/appengine-staging/app.yaml']
我有一个 Spring 启动应用程序,我想将其自动部署到 App Engine。我不想创建 docker 映像然后部署它。由于 'Cloud SDK not found error'
,构建失败[ERROR] Failed to execute goal com.google.cloud.tools:appengine-maven-plugin:1.3.2:deploy (default-cli) on project location-finder-rest-api: Execution default-cli of goal com.google.cloud.tools:appengine-maven-plugin:1.3.2:deploy failed: The Google Cloud SDK could not be found in the customary locations and no path was provided.
我遵循了 https://cloud.google.com/source-repositories/docs/quickstart-triggering-builds-with-source-repositories 中的所有指南。
根据文档,app.yaml 文件创建于 src/main/appengine。 app.yaml的内容是
# [START runtime]
runtime: java
env: flex
handlers:
- url: /.*
script: this field is required, but ignored
runtime_config: # Optional
jdk: openjdk8
manual_scaling:
instances: 1
# [END runtime]
为了触发构建,我必须指定 cloudbuild.yaml 文件。该文件的内容是:
steps:
- name: 'gcr.io/cloud-builders/mvn'
args: ['appengine:deploy','-Pprod']
cloud-builder 的官方文档建议使用 'install' 作为 mvn 步骤的参数。但是这一步并没有部署应用程序。
我是否缺少任何配置?
在幕后,appengine:deploy
目标使用 Cloud SDK 实际部署您的应用程序。 gcr.io/cloud-builders/mvn
映像不提供它(每个 Cloud Build 步骤都在其自己的容器中运行)。
您可以使用单独的构建步骤来安装和部署您的应用,例如:
steps:
- name: 'gcr.io/cloud-builders/mvn'
args: ['install']
- name: 'gcr.io/cloud-builders/gcloud'
args: ['app', 'deploy']
它通过对 LundinCast 上面建议的解决方案稍作修改而起作用。此外,appengine maven插件需要更新到2.0.0+。此版本会自动下载必要的依赖项。
steps:
- id: 'Stage app using mvn appengine plugin on mvn cloud build image'
name: 'gcr.io/cloud-builders/mvn'
args: ['package', 'appengine:stage', '-Pprod']
- id: "Deploy to app engine using gcloud image"
name: 'gcr.io/cloud-builders/gcloud'
args: ['app', 'deploy', 'target/appengine-staging/app.yaml']