Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.