GoogleCloudPlatform / app-gradle-plugin

The library has moved to https://github.com/GoogleCloudPlatform/appengine-plugins/tree/main/app-gradle-plugin
Apache License 2.0
153 stars 40 forks source link

App Engine deploy fails with TypeError in Cloud Build #340

Closed marcelogp closed 5 years ago

marcelogp commented 5 years ago

I'm writing a simple cloudbuild.yaml file to deploy my spring boot server:

steps:
  - name: 'gcr.io/cloud-builders/gradle'
    args: ['appengineDeploy']
timeout: "1600s"

I'm using appengine-gradle-plugin:2.0.0-rc6 since I need the gcloud SDK. However, the build fails with:

:mainSass
:processResources
:classes
:bootJar
:inspectClassesForKotlinIC
:jar
:assemble
Apr 18, 2019 3:31:58 PM com.google.cloud.tools.managedcloudsdk.install.Downloader download
INFO: Downloading https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.tar.gz to /root/.cache/google-cloud-tools-java/managed-cloud-sdk/downloads/google-cloud-sdk.tar.gz
:downloadCloudSdk
Welcome to the Google Cloud SDK!
WARNING: You appear to be running this script as root. This may cause 
the installation to be inaccessible to users other than the root user.

Your current Cloud SDK version is: 242.0.0
Installing components from version: 242.0.0

+----------------------------------------------------------------------------+
|                    These components will be installed.                     |
+-----------------------------------------------------+------------+---------+
|                         Name                        |  Version   |   Size  |
+-----------------------------------------------------+------------+---------+
| BigQuery Command Line Tool                          |     2.0.43 | < 1 MiB |
| BigQuery Command Line Tool (Platform Specific)      |     2.0.34 | < 1 MiB |
| Cloud SDK Core Libraries (Platform Specific)        | 2018.09.24 | < 1 MiB |
| Cloud Storage Command Line Tool                     |       4.38 | 3.8 MiB |
| Cloud Storage Command Line Tool (Platform Specific) |       4.34 | < 1 MiB |
| Default set of gcloud commands                      |            |         |
| gcloud cli dependencies                             | 2018.08.03 | 8.6 MiB |
+-----------------------------------------------------+------------+---------+

For the latest full release notes, please visit:
  https://cloud.google.com/sdk/release_notes

#============================================================#
#= Creating update staging area                             =#
#============================================================#
#= Installing: BigQuery Command Line Tool                   =#
#============================================================#
#= Installing: BigQuery Command Line Tool (Platform Spec... =#
#============================================================#
#= Installing: Cloud SDK Core Libraries (Platform Specific) =#
#============================================================#
#= Installing: Cloud Storage Command Line Tool              =#
#============================================================#
#= Installing: Cloud Storage Command Line Tool (Platform... =#
#============================================================#
#= Installing: Default set of gcloud commands               =#
#============================================================#
#= Installing: gcloud cli dependencies                      =#
#============================================================#
#= Creating backup and activating new installation          =#
#============================================================#
Performing post processing steps...
......................................done.

Update done!

This will install all the core command line tools necessary for working with
the Google Cloud Platform.

==> Source [/root/.cache/google-cloud-tools-java/managed-cloud-sdk/LATEST/google-cloud-sdk/completion.bash.inc] in your profile to enable shell command completion for gcloud.
==> Source [/root/.cache/google-cloud-tools-java/managed-cloud-sdk/LATEST/google-cloud-sdk/path.bash.inc] in your profile to add the Google Cloud SDK command line tools to your $PATH.

For more information on how to get started, please visit:
  https://cloud.google.com/sdk/docs/quickstarts
:appengineStage
Apr 18, 2019 3:32:17 PM com.google.cloud.tools.appengine.operations.GcloudRunner run
INFO: submitting command: /root/.cache/google-cloud-tools-java/managed-cloud-sdk/LATEST/google-cloud-sdk/bin/gcloud app deploy /workspace/build/staged-app/app.yaml --promote --stop-previous-version --project wappbot11
:appengineDeploy
ERROR: gcloud crashed (TypeError): unorderable types: NoneType() > int()

If you would like to report this issue, please run the following command:
  gcloud feedback

To check gcloud for common problems, please run the following command:
  gcloud info --run-diagnostics
:appengineDeploy FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':appengineDeploy'.
> com.google.cloud.tools.appengine.AppEngineException: com.google.cloud.tools.appengine.operations.cloudsdk.process.ProcessHandlerException: com.google.cloud.tools.appengine.AppEngineException: Non zero exit: 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
See https://docs.gradle.org/4.6/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 5m 43s
10 actionable tasks: 10 executed
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/gradle" failed: exit status 1

I think this is related to python2 vs. python3 for gcloud. I tried setting CLOUDSDK_PYTHON but I don't know where/if python2 is installed. Any ideas?

loosebazooka commented 5 years ago

That's interesting, let me see if the cloud build or cloud sdk team has any insights. @ImJasonH, @vilasj

loosebazooka commented 5 years ago

In the meantime if you want to inspect the build container on your local machine:

$ docker pull gcr.io/cloud-builders/gradle
$ docker run -it --entrypoint=/bin/bash gcr.io/cloud-builders/gradle

python appears to be in: /usr/bin/python*

marcelogp commented 5 years ago

Yeah, I checked the image and there's only python3 installed.

loosebazooka commented 5 years ago

Yeah you're going to have to put python2.7 in there yourself for now. But I would file a bug against the cloud-build repository asking for python2.7 in their base images (https://github.com/GoogleCloudPlatform/cloud-builders)

$ apt-get update
$ apt-get -y install python2.7

This worked for me (haven't tried in a cloudbuild.yaml file though)

loosebazooka commented 5 years ago

@marcelogp I'm going to go ahead and close this here for now. Please re-open or create a bug on the cloud-builders page if you still need assistance.