Created
May 13, 2022 12:22
-
-
Save andreciornavei/bff0eb24b10f1d836e027390d0765df6 to your computer and use it in GitHub Desktop.
Authenticate with GCP on shell through service account in Base64 variable.
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
#!/bin/bash | |
# TO CONVERT A SERVICEACCOUNT FILE IN BASE64 AND SAVE IT TO A VARIABLE | |
# RUN: "CI_GCLOUD_SERVICE_ACCOUNT_BASE64=$(base64 ./xapps-terraform.json)" | |
# TO CONVERT A SERVICEACCOUNT BASE64 TO FILE AND USE IT WITH CLI SDK | |
echo $CI_GCLOUD_SERVICE_ACCOUNT_BASE64 | base64 -d > ./serviceaccount.json | |
wget https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.tar.gz | |
tar zxvf google-cloud-sdk.tar.gz && ./google-cloud-sdk/install.sh --usage-reporting=false --path-update=true | |
google-cloud-sdk/bin/gcloud auth activate-service-account --key-file ./serviceaccount.json | |
google-cloud-sdk/bin/gcloud config list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment