Skip to content

Commit

Permalink
Activate account when SERVICE_ACCOUNT_EMAIL is provided (#56)
Browse files Browse the repository at this point in the history
* Activate account when SERVICE_ACCOUNT_EMAIL is provided
  • Loading branch information
armandomiani authored Apr 4, 2024
1 parent 7ea6832 commit 87c0d63
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/build-vm-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ function _register_gcloud_config() {


if [[ -v SERVICE_ACCOUNT_EMAIL ]]; then
declare -r active_account="$(gcloud auth list \
--filter "status:ACTIVE" \
--format "value(account)")"

_register_gcloud_config
gcloud config set account "${active_account}"
else
# If the service account e-mail is not specified, check that the
# key file is mounted.
Expand All @@ -58,7 +63,6 @@ fi

# Print environment variables.
env

gcloud info

# Set default value for unset variables.
Expand Down

0 comments on commit 87c0d63

Please sign in to comment.