gitpod/scripts/setup-google-adc.sh
mustard a60b913198 Revert "Fix the shell error"
This reverts commit 26a8f3fd7721a0ae85513ebc9eafe3be9cfc5e7b.
2022-04-20 19:48:33 +05:30

23 lines
840 B
Bash
Executable File

#!/bin/bash
# #### Instructions to fill the GCP_ADC_FILE env var
# 1. `gcloud auth login <gcp-email>` and authenticate
# 2. `gcloud auth application-default login` and authenticate
# 3. `cat ~/.config/gcloud/application_default_credentials.json` and copy the output
# 4. Go to https://gitpod.io/settings/ and create:
# - name: GCP_ADC_FILE
# - value: paste-the-output
# - repo: gitpod-io/gitpod
GCLOUD_ADC_PATH="/home/gitpod/.config/gcloud/application_default_credentials.json"
if [ ! -f "$GCLOUD_ADC_PATH" ]; then
if [ -z "$GCP_ADC_FILE" ]; then
echo "GCP_ADC_FILE not set, doing nothing."
return;
fi
echo "$GCP_ADC_FILE" > "$GCLOUD_ADC_PATH"
#echo "Set GOOGLE_APPLICATION_CREDENTIALS value based on contents from GCP_ADC_FILE"
fi
export GOOGLE_APPLICATION_CREDENTIALS="$GCLOUD_ADC_PATH"