maven - cli 的 GAE 成功,Cloud Build 的失败。错误:未找到
问题描述
我有一个部署到 Google App Engine 并在从命令行部署时工作的 Java 应用程序。当我从 Cloud Build 运行该构建时,该构建显示为绿色。当我点击 URL 时,我收到一条消息错误:未找到。请注意,我已经为这篇文章替换了我的 GAE 项目的名称和在其中运行的服务名称。
以下是我从 shell 运行它们时的命令:
git clone git@github.com:johncrider/MyProj
cd MyProj/
/Applications/apache-maven-3.6.0/bin/mvn clean package
gcloud app deploy src/main/webapp/WEB-INF/appengine-web.xml
这是 cloudbuild.yaml 的内容,它让我在 Cloud Build 中开了绿灯:
steps:
# Decrypt the file containing the key
- name: 'gcr.io/cloud-builders/gcloud'
args:
- kms
- decrypt
- --ciphertext-file=id_rsa.enc
- --plaintext-file=/root/.ssh/id_rsa
- --location=global
- --keyring=my-keyring
- --key=github-key
volumes:
- name: 'ssh'
path: /root/.ssh
# Set up git with key and domain.
- name: 'gcr.io/cloud-builders/git'
entrypoint: 'bash'
args:
- '-c'
- |
chmod 600 /root/.ssh/id_rsa
cat <<EOF >/root/.ssh/config
Hostname github.com
IdentityFile /root/.ssh/id_rsa
EOF
mv known_hosts /root/.ssh/known_hosts
volumes:
- name: 'ssh'
path: /root/.ssh
# Use git clone.
- name: 'gcr.io/cloud-builders/git'
args:
- clone
- git@github.com:johncrider/MyProj
volumes:
- name: 'ssh'
path: /root/.ssh
# set default project
- name: "gcr.io/cloud-builders/gcloud"
args: ["config", "set", "project", "GAEProject"]
# build maven package
- name: 'gcr.io/cloud-builders/mvn'
args: ['clean', 'package', '-DskipTests']
volumes:
- name: 'ssh'
path: /root/.ssh
#Deploy to GAE
- name: "gcr.io/cloud-builders/gcloud"
args: ["app", "deploy", "src/main/webapp/WEB-INF/appengine-web.xml"]
volumes:
- name: 'ssh'
path: /root/.ssh
timeout: "1600s"
最后一步是第 5 步。这是来自 Cloud Build Logs 的该步骤的结果。
Starting Step #5
Step #5: Already have image (with digest): gcr.io/cloud-builders/gcloud
Step #5: Services to deploy:
Step #5:
Step #5: descriptor: [/workspace/src/main/webapp/WEB-INF/appengine-web.xml]
Step #5: source: [/workspace/src/main/webapp]
Step #5: target project: [gaeproject]
Step #5: target service: [myproject]
Step #5: target version: [20190110t151311]
Step #5: target url: [https://myproject-dot-gaeproject.appspot.com]
Step #5:
Step #5:
Step #5: Do you want to continue (Y/n)?
Step #5: Beginning deployment of service [myproject]...
Step #5: #============================================================#
Step #5: #= Uploading 0 files to Google Cloud Storage =#
Step #5: #============================================================#
Step #5: File upload done.
Step #5: Updating service [myproject]...
Step #5: ............................................................done.
Step #5: Setting traffic split for service [myproject]...
Step #5: .............done.
Step #5: Deployed service [myproject] to [https://myproject-dot-gaeproject.appspot.com]
Step #5:
Step #5: You can stream logs from the command line by running:
Step #5: $ gcloud app logs tail -s myproject
Step #5:
Step #5: To view your application in the web browser run:
Step #5: $ gcloud app browse -s myproject
Finished Step #5
服务启动时的日志条目没有显示任何错误。
解决方案
推荐阅读
- logback - 如何为 logback 中的单个日志文件定义多个滚动策略?
- algorithm - Get-Record-API 请求不再起作用
- reactjs - Display: none on Deck.gl React 组件导致巨大的性能问题
- javascript - 重定向到组件 onSubmit
- ios - 模拟 iOS Firebase Auth 登录方法
- javascript - 尝试使用 javascript 中的 DOM 创建颜色更改应用程序
- python - 模板匹配使用 opencv 的屏幕截图
- sql - 如何找出方法中会抛出的异常?
- angularjs - 过滤列并在AngularJS中按降序排序
- postgresql - postgresql libpqxx:多个查询作为一个事务