Pipeline failing all of a sudden. Python version issue.
Asked by Bruce Wilcox:

I know nothing about how python comes into play and how to set the version. Any help appreciated.

Getting error:

ERROR: Python 2 is not compatible with the Google Cloud SDK. Please use Python version 3.5 and up. `If you have a compatible Python interpreter installed, you can use it by setting` `the CLOUDSDK_PYTHON environment variable to point to it.`  
Here is my pipelne;  

```
branches:

master:

- step:

caches:

- maven

image: maven:3.8.1-openjdk-8

name: Build, stage, and deploy App Engine content

deployment: production

script:

- mvn -D skipTests=true -P useJfrog --settings settings.xml install appengine:stage

- mvn dependency:tree

- ls -la

- ls -la target/appengine-staging/app.yaml

- cat target/appengine-staging/app.yaml

- pipe: atlassian/google-app-engine-deploy:1.1.1

variables:

KEY_FILE: ${xxxx_SERVICE_ACCOUNT_KEY}

PROJECT: 'xxxx'

DEPLOYABLES: 'target/appengine-staging/app.yaml'

VERSION: 'xxxx-${BITBUCKET_BUILD_NUMBER}'

PROMOTE: 'true'

...
```


Answers:
author: Patrik S
body: Hello [@Bruce Wilcox](/t5/user/viewprofilepage/user-id/1643739) ,

Thank you for reaching out to Atlassian Community!

Could you share which exact command is throwing the Python version error? Was it a command of your step's script or was it the pipe **atlassian/google-app-engine-deploy:1.1.1** ?

If it was the pipe, could you please include the DEBUG variable in the pipe definition and share the logs here with us?

```
script:  - pipe: atlassian/google-app-engine-deploy:1.1.1    variables:      <rest of your pipe variables>      DEBUG: 'true'
```

Thank you, [@Bruce Wilcox](/t5/user/viewprofilepage/user-id/1643739) !

Patrik S

comments: author: Bruce Wilcox
body: Thanks for taking an interest in this.

The maven appengine:stage is failing all of a sudden:

```
mvn -D skipTests=true -P useJfrog --settings settings.xml package appengine:stage
```

Here is an excerpt from log:

```
[INFO] Staging the application to: /opt/atlassian/pipelines/agent/build/target/appengine-staging
[INFO] Detected App Engine appengine-web.xml based application.
Apr 20, 2023 7:15:25 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
Welcome to the Google Cloud CLI!
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.
ERROR: Python 2 is not compatible with the Google Cloud SDK. Please use Python version 3.5 and up.
If you have a compatible Python interpreter installed, you can use it by setting
the CLOUDSDK_PYTHON environment variable to point to it.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
```


author: Bruce Wilcox
body: [@Patrik S](/t5/user/viewprofilepage/user-id/4603309) I have another Google App Engine project that uses Java 11 and Spring Boot and builds using image: maven:3.8.1-openjdk-11. It still builds and deploys successfully.

It appears that the "sudden" change is actually on the part of the Google CLI/SDK discontinuing support for Python 2.

I still think that Atlassian could provide a great service by recommending Docker images that work for the App Engine use cases.

Again, the steps that the pipeline needs to run back to back are:

```
script:
   - mvn install appengine:stage
   - pipe: atlassian/google-app-engine-deploy:1.1.1
```

I remain stuck and appreciate your help.


author: Bruce Wilcox
body: Docker image **maven:3.8.3-openjdk-8** got me back up and running.


author: Nin Tran
body: I use image maven:3.8.3-jdk-11 and it worked


author: Christian James
body: Hi Bruce,  
To resolve this issue, you need to install Python 3.5 or higher and set the CLOUDSDK_PYTHON environment variable to point to the location of the Python 3.5 executable.

comments: author: Heigo Varik
body: Hi Christian, could you please direct me to an example on how to do that?


author: Bruce Wilcox
body: How do I **install Python** on BitBucket cloud?

Are you sure this is a valid answer?

Right now the pipeline is using Docker image:

maven:3.8.1-openjdk-8

This image has maven, java 8, and Python 2.

What image has maven, java 8, and Python 3.5 or higher?

I wish the README.md at:

<https://bitbucket.org/atlassian/google-app-engine-deploy/src/master/>

would suggest images that work.


Tags: bitbucket-cloud

cloud