简体   繁体   中英

Google Cloud Build can't find Python venv… For Java Spring Boot project

I have a usual Java 11 Spring Boot application that is deployed to Heroku at the moment.

I can deploy the app manually to AppEngine via a local call to gcloud app deploy

However, I'm struggling for about 2 hours to make the Google Cloud Build to build and deploy the application automatically. It crashes not being able to find python, but I have absolutely no idea why does it try to look for the python anyway.

Here is the 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']

Here is the app yaml in the same root folder:

runtime: java11
env: standard
instance_class: F2
automatic_scaling:
  max_instances: 1

Here is the error part of the 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

It appeared that some time ago we've added a few python scripts for db migration. In addition to the script, a venv folder was created.

Looks like AppEngine triggers it as a clue that the project is Python-based, even if you set a particular app.yaml telling to use Java.

Deleting the venv folder resolved the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM