This repo demonstrates how to deploy to Google Cloud from a Circle CI file and run an end to end test (in e2e_test.py) against a staging environment.
See the managed_vms branch for a similar repo and Circle deployment using Managed VMs.
First, you must create a Cloud project. Two types of credentials are required. The first is a service account to authorize the gcloud command line tool in the Circle CI environment, which is used to deploy the project. The second is an API key used to access the Books API.
Both of the credentials need to be base64 encoded and added to the Circle CI project as an environment variable.
Go to Circle CI. If you haven't already done so, create an account and enable your project.
On the top right, click Project Settings
, then on the left click Environment Variables
.
Base64 encode the client secret JSON file
base64 <your_secret.json>
Copy the output of the base64 command into the 'Value' form, with the name CLIENT_SECRET, then click Save Variable
.
Base64 encdode the api_key.py file
base64 api_key.py
Copy the output of the base64 command into the 'Value' form, with the Name field set to API_KEY. Click Save Variable
.
In the circle.yaml file, replace the gcloud config set project
with your project id.
In e2e_test.py, replace the https://your-project-id.appspot.com
.
Commit and push your changes. The circle project should run the local tests, then use the gcloud SDK (authenticated with the client-secret) to deploy to the appspot URL, then run the e2e tests against that URL.
Copyright (C) 2015 Google Inc.