Skip to content

Instantly share code, notes, and snippets.

@stewartpark
Last active May 31, 2017 05:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stewartpark/21847ef93227241c3785f90f6795bec2 to your computer and use it in GitHub Desktop.
Save stewartpark/21847ef93227241c3785f90f6795bec2 to your computer and use it in GitHub Desktop.
setup-gcloud.sh
#!/bin/sh
# This script is to set up Google Cloud in CircleCI
# Author: Stewart Park <hello@stewartjpark.com>
#
# Usage:
# (set up GCLOUD_SERVICE_KEY as a base64-encoded json credentials file, GCLOUD_PROJECT_ID as your project ID)
# curl -L https://goo.gl/6pDHc6 | bash
sudo -E env "PATH=$PATH" gcloud --quiet components update
sudo chmod 757 /home/ubuntu/.config/gcloud/logs -R
echo $GCLOUD_SERVICE_KEY | base64 --decode --ignore-garbage > ${HOME}/gcloud-service-key.json
gcloud --quiet components update
gcloud auth activate-service-account --key-file ${HOME}/gcloud-service-key.json
gcloud config set project $GCLOUD_PROJECT_ID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment