Last active
November 10, 2016 23:49
-
-
Save jeremydw/6f3d193ee870bfc286cc1697c010d022 to your computer and use it in GitHub Desktop.
Continuous staging with Grow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Activate the "App Engine Admin API" API. https://console.cloud.google.com/apis/api/appengine/overview?project=PROJECT | |
1. Create a service account and download a JSON private key. | |
1. Ensure the service account has "editor" access to the Cloud project. | |
1. Run `base64 <file>.json | pbcopy` | |
1. Paste the key into a Circle CI environment variable `CLIENT_SECRET`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
general: | |
artifacts: ~ | |
machine: | |
environment: | |
SUBDOMAIN: $(echo $CIRCLE_BRANCH | sed -e 's/\//-/g' | sed -e 's/^feature-//g') | |
python: | |
version: 2.7.11 | |
test: | |
override: ~ | |
dependencies: | |
pre: | |
- echo $CLIENT_SECRET | base64 --decode > $HOME/client-secret.json | |
- pip install grow | |
- make develop | |
- gcloud --quiet components update app | |
- gcloud auth activate-service-account --key-file $HOME/client-secret.json | |
cache_directories: | |
- bower_components | |
- build | |
- lib | |
- ~/.cache/pip/ | |
deployment: | |
deploy: | |
branch: master | |
commands: | |
- make prod_version=$CIRCLE_SHA1 deploy | |
stage: | |
branch: /^((?!master).)*$/ | |
commands: | |
- make staging_version=$SUBDOMAIN stage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
prod_version ?= prod | |
project ?= PROJECT | |
staging_version ?= staging | |
develop: | |
pip install -t lib grow | |
grow install | |
test: | |
grow build | |
stage: | |
PATH=$(PATH):$(HOME)/bin grow deploy -f review | |
gcloud preview app deploy \ | |
-q \ | |
--project=$(project) \ | |
--version=$(staging_version) \ | |
--verbosity=error \ | |
--no-promote \ | |
app.yaml | |
deploy: | |
PATH=$(PATH):$(HOME)/bin grow deploy -f review | |
gcloud preview app deploy \ | |
-q \ | |
--project=$(project) \ | |
--version=$(prod_version) \ | |
--verbosity=error \ | |
--promote \ | |
app.yaml | |
run-gae: | |
dev_appserver.py --allow_skipped_files=true . | |
.PHONY: develop deploy run-gae test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment