Spring boot Google AppEngine-自动部署到应用程序引擎失败
我有一个springboot应用程序,我想自动部署到appengine。我不想创建docker映像,然后部署它。由于“未找到云SDK错误”,生成失败Spring boot Google AppEngine-自动部署到应用程序引擎失败,spring-boot,google-app-engine,google-cloud-build,Spring Boot,Google App Engine,Google Cloud Build,我有一个springboot应用程序,我想自动部署到appengine。我不想创建docker映像,然后部署它。由于“未找到云SDK错误”,生成失败 [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.
[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.
我当时遵守了所有的指导方针
根据文档,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的官方文档建议使用“安装”作为mvn步骤的参数。但此步骤不会部署应用程序
我是否缺少任何配置?在引擎盖下,
appengine:deploy
目标使用云SDK实际部署你的应用程序。它不是由gcr.io/cloud builders/mvn
映像提供的(每个云构建步骤都在自己的容器中运行)
您可以使用单独的构建步骤来安装和部署应用程序,例如:
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']