Get started with Bitbucket Cloud
New to Bitbucket Cloud? Check out our get started guides for new users.
You need a Google service account key. For more guidance see Google's guide to creating service keys.
Ensure that an IAM user is configured with sufficient permissions to perform a deployment of your application using gcloud.
Enable the right APIs and services needed for your application.
All cloud components are installed.
Clone the Google App Engine example repository.
Create a Google service account key. For more guidance see Google's guide to creating service keys.
Once you have your key file, open up a terminal and browse to the location of your key file.
Encode your file in base64 format: base64 -w 0 <your-key-file> and copy the output of the command.
Note: for some versions of MacOS the -w 0 is not necessary.
In your repo go to Repository settings, under Pipelines, select Repository variables and create a new variable named KEY_FILE and paste the encoded service account credentials.
Configure the pipe and add the variables: PROJECT and KEY_FILE
PROJECT (*): The project that owns the app to deploy.
KEY_FILE (*): base64 encoded Key file for a Google service account.
DEPLOYABLES: List of white space separated yaml files to be passed to gcloud. Default "". If left empty, the app.yaml from the current directory will be used.
VERSION: The version of the app to be created/replaced.
BUCKET: A google cloud storage bucket to store the files associated with the deployment.
IMAGE: Deploy with a specific GCR docker image.
PROMOTE: If true the deployed version receives all traffic, false to not receive traffic.
STOP_PREVIOUS_VERSION: If true the previous version receiving traffic is stopped, false to not stop the previous version.
EXTRA_ARGS: Extra arguments to be passed to the CLI (see Google app deploy docs for more details).
DEBUG: Turn on extra debug information. Default false.
(*) = required variable.
End to end example
Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
image: node:10.15.1
pipelines:
default:
- step:
name: Build and Test
script:
- npm install
- npm test
- step:
name: Deploy
script:
- pipe: atlassian/google-app-engine-deploy:0.2.1
variables:
KEY_FILE: $KEY_FILE
PROJECT: 'my-project'
Deploy multiple deployables
Example
1
2
3
4
5
6
7
8
9
10
11
12
script:
- pipe: atlassian/google-app-engine-deploy:0.4.1
variables:
KEY_FILE: $KEY_FILE
PROJECT: 'my-project'
DEPLOYABLES: 'app-1.yaml app-2.yaml'
VERSION: 'alpha'
BUCKET: 'gs://my-bucket'
IMAGE: 'gcr.io/my/image'
PROMOTE: 'true'
STOP_PREVIOUS_VERSION: 'true'
EXTRA_ARGS: '--verbosity=debug'
Example
1
2
3
4
5
6
7
8
9
10
script:
- pipe: atlassian/google-app-engine-deploy:0.4.1
variables:
KEY_FILE: $KEY_FILE_PYTHON_APP
PROJECT: 'pipes-example-python3-app'
DEPLOYABLES: 'hello_world/app.yaml'
VERSION: '${BITBUCKET_BUILD_NUMBER}'
PROMOTE: 'true'
STOP_PREVIOUS_VERSION: 'true'
EXTRA_ARGS: '--verbosity=debug --quiet'
Example
1
2
3
4
5
6
7
8
script:
- pipe: atlassian/google-app-engine-deploy:0.4.1
variables:
KEY_FILE: $KEY_FILE
PROJECT: 'pipes-java-maven-spring-boot'
DEPLOYABLES: 'target/appengine-staging/app.yaml'
VERSION: '${BITBUCKET_BUILD_NUMBER}'
EXTRA_ARGS: '--verbosity=debug'
Example
1
2
3
4
5
6
7
8
9
script:
- pipe: atlassian/google-app-engine-deploy:0.4.1
variables:
KEY_FILE: $KEY_FILE
PROJECT: 'pipes-java-gradle-spring-boot'
DEPLOYABLES: 'build/staged-app/app.yaml'
# DEPLOYABLES: 'src/main/WEB-INF/appengine-web.xml' # or you can provide web.xml
VERSION: '${BITBUCKET_BUILD_NUMBER}'
EXTRA_ARGS: '--verbosity=debug'
Example
1
2
3
4
5
6
7
8
script:
- pipe: atlassian/google-app-engine-deploy:0.4.1
variables:
KEY_FILE: $KEY_FILE
PROJECT: 'pipes-java-gradle-spring-boot'
DEPLOYABLES: 'src/main/WEB-INF/appengine-web.xml'
VERSION: '${BITBUCKET_BUILD_NUMBER}'
EXTRA_ARGS: '--verbosity=debug'
Example
1
2
3
4
5
6
7
8
9
10
script:
- pipe: atlassian/google-app-engine-deploy:0.4.1
variables:
KEY_FILE: $KEY_FILE
PROJECT: 'pipes-example-java-app-maven'
DEPLOYABLES: 'target/appengine-staging/app.yaml'
VERSION: '${BITBUCKET_BUILD_NUMBER}'
PROMOTE: 'true'
STOP_PREVIOUS_VERSION: 'true'
EXTRA_ARGS: '--verbosity=debug'
Example
1
2
3
4
5
6
7
8
9
10
script:
- pipe: atlassian/google-app-engine-deploy:0.4.1
variables:
KEY_FILE: $KEY_FILE
PROJECT: 'pipes-example-java-app-maven'
DEPLOYABLES: 'target/appengine-staging/WEB-INF/appengine-web.xml'
VERSION: '${BITBUCKET_BUILD_NUMBER}'
PROMOTE: 'true'
STOP_PREVIOUS_VERSION: 'true'
EXTRA_ARGS: '--verbosity=debug'
Example
1
2
3
4
5
6
7
8
9
10
script:
- pipe: atlassian/google-app-engine-deploy:0.4.1
variables:
KEY_FILE: $KEY_FILE
PROJECT: 'pipes-example-java-app-gradle'
DEPLOYABLES: 'build/exploded-helloworld/WEB-INF/appengine-web.xml'
VERSION: '${BITBUCKET_BUILD_NUMBER}'
PROMOTE: 'true'
STOP_PREVIOUS_VERSION: 'true'
EXTRA_ARGS: '--verbosity=debug'
Example
1
2
3
4
5
6
7
8
9
10
script:
- pipe: atlassian/google-app-engine-deploy:0.4.1
variables:
KEY_FILE: $KEY_FILE
PROJECT: 'pipes-example-java-app-gradle'
DEPLOYABLES: 'build/staged-app/app.yaml'
VERSION: '${BITBUCKET_BUILD_NUMBER}'
PROMOTE: 'true'
STOP_PREVIOUS_VERSION: 'true'
EXTRA_ARGS: '--verbosity=debug'
Was this helpful?