Add "/snap/bin" to PATH.

"gcloud" may be installed as a snap, under "/snap/bin". Make
sure this is in our PATH so that we can use gcloud.

PiperOrigin-RevId: 304297180
This commit is contained in:
Zach Koopmans 2020-04-01 17:39:12 -07:00 committed by gVisor bot
parent 1561ae3037
commit 37025990d6
1 changed files with 9 additions and 2 deletions

View File

@ -16,12 +16,19 @@
source $(dirname $0)/common.sh source $(dirname $0)/common.sh
# gcloud may be installed as a "snap". If it is, include it in PATH.
declare -r snap="/snap/bin"
if [[ -d "-d ${snap}" ]]; then
export PATH="${PATH}:${snap}"
fi
# Make sure we can call gcloud and exit if not.
which gcloud
# Exporting for subprocesses as GCP APIs and tools check this environmental # Exporting for subprocesses as GCP APIs and tools check this environmental
# variable for authentication. # variable for authentication.
export GOOGLE_APPLICATION_CREDENTIALS="${KOKORO_KEYSTORE_DIR}/${GCLOUD_CREDENTIALS}" export GOOGLE_APPLICATION_CREDENTIALS="${KOKORO_KEYSTORE_DIR}/${GCLOUD_CREDENTIALS}"
which gcloud
gcloud auth activate-service-account \ gcloud auth activate-service-account \
--key-file "${GOOGLE_APPLICATION_CREDENTIALS}" --key-file "${GOOGLE_APPLICATION_CREDENTIALS}"