java - Google Cloud Build 找不到 Python venv... 对于 Java Spring Boot 项目
问题描述
我现在有一个部署到 Heroku 的常用 Java 11 Spring Boot 应用程序。
我可以通过本地调用手动将应用程序部署到 AppEnginegcloud app deploy
但是,为了让 Google Cloud Build 自动构建和部署应用程序,我苦苦挣扎了大约 2 个小时。它崩溃无法找到python,但我完全不知道为什么它仍然试图寻找python。
这是cloubuild.yaml
:
- name: maven:3.6.3-adoptopenjdk-11
entrypoint: mvn
args: ['--version']
- name: maven:3.6.3-adoptopenjdk-11
entrypoint: mvn
args: ['package']
- name: 'gcr.io/cloud-builders/gcloud'
args: ['app', 'deploy', 'app.yaml']
这是同一根文件夹中的应用 yaml:
runtime: java11
env: standard
instance_class: F2
automatic_scaling:
max_instances: 1
这是输出的错误部分:
Step #2: descriptor: [/workspace/app.yaml]
Step #2: source: [/workspace]
Step #2: target project: [atomic-parity-282520]
Step #2: target service: [default]
Step #2: target version: [20200711t113051]
Step #2: target url: [https://atomic-parity-282520.ew.r.appspot.com]
Step #2:
Step #2:
Step #2: Do you want to continue (Y/n)?
Step #2: Beginning deployment of service [default]...
Step #2: Created .gcloudignore file. See `gcloud topic gcloudignore` for details.
Step #2: ERROR: gcloud crashed (OSError): [Errno 2] No such file or directory: '/workspace/venv/bin/python3'
Step #2:
Step #2: If you would like to report this issue, please run the following command:
Step #2: gcloud feedback
Step #2:
Step #2: To check gcloud for common problems, please run the following command:
Step #2: gcloud info --run-diagnostics
Finished Step #2
ERROR
ERROR: build step 2 "gcr.io/cloud-builders/gcloud" failed: step exited with non-zero status: 1
解决方案
似乎前段时间我们添加了一些用于数据库迁移的 python 脚本。除了脚本之外,venv
还创建了一个文件夹。
看起来 AppEngine 触发它作为该项目基于 Python 的线索,即使您设置了特定app.yaml
的使用 Java 的指示。
删除venv
文件夹解决了这个问题。
推荐阅读
- python - (tkinter) 为什么我的变量不使用标签显示?
- python - Tensorflow - 获取像素邻域
- django - 如何预取 Wagtail 帖子标签?
- python - 运行时的备用 tensorflow hub 模块标签
- python - 如何将单个用户标识的多行写入数据框
- python-3.x - PyQt:在当前命令的撤消期间从 UndoStack 弹出先前的命令
- mongodb - Parse Server 应用程序的 MongoDB 索引
- asp.net-mvc - 无法让 MVC 在 asp.net Web 表单项目中工作
- c# - DateTimeStyles 和 WhiteSpaces 字符
- python - 与 gitlab-ci 中的父范围 docker 容器共享 docker 容器中的目录?