[英]Google Cloud Build can't find Python venv… For Java Spring Boot project
我有一個常用的 Java 11 Spring 目前部署到 Heroku 的引導應用程序。
我可以通過本地調用gcloud app deploy
將應用手動部署到 AppEngine
但是,為了讓 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
這是output的錯誤部分:
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
文件夾解決了該問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.