Skip to content

Instantly share code, notes, and snippets.

@candidosales
Last active June 20, 2018 00:11
Show Gist options
  • Save candidosales/5454c5faaf67c628a04a8922f369ab2d to your computer and use it in GitHub Desktop.
Save candidosales/5454c5faaf67c628a04a8922f369ab2d to your computer and use it in GitHub Desktop.
Gitlab CI + App Engine
image: google/cloud-sdk:latest
stages:
- deploy
####################################################################################################
# DEPLOY
#
.deploy_template: &deploy_template_def
stage: deploy
after_script:
- rm /tmp/$CI_PIPELINE_ID.json
deploy_staging:
<<: *deploy_template_def
environment:
name: staging
only:
- staging
script:
- echo $GOOGLE_APP_ENGINE_KEY_STAGING > /tmp/$CI_PIPELINE_ID.json
- gcloud auth activate-service-account --key-file /tmp/$CI_PIPELINE_ID.json
- gcloud config set project $GOOGLE_PROJECT_STAGING_ID
- gcloud info
- gcloud --quiet app deploy
deploy_production:
<<: *deploy_template_def
environment:
name: production
when: manual
only:
- master
script:
- echo $GOOGLE_APP_ENGINE_KEY_PRODUCTION > /tmp/$CI_PIPELINE_ID.json
- gcloud auth activate-service-account --key-file /tmp/$CI_PIPELINE_ID.json
- gcloud config set project $GOOGLE_PROJECT_PRODUCTION_ID
- gcloud info
- gcloud --quiet app deploy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment