mirror of
https://github.com/vmware-tanzu/pinniped.git
synced 2026-01-08 07:11:53 +00:00
improve how scripts check for gcloud auth
This commit is contained in:
@@ -23,11 +23,10 @@ if ! command -v gcloud &> /dev/null; then
|
||||
echo "Please install the gcloud CLI"
|
||||
exit 1
|
||||
fi
|
||||
if [[ -z "$(gcloud config list account --format "value(core.account)")" ]]; then
|
||||
echo "Please run \`gcloud auth login\`"
|
||||
if ! gcloud auth print-access-token &>/dev/null; then
|
||||
echo "Please run \`gcloud auth login\` and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${PINNIPED_GCP_PROJECT:-}" ]]; then
|
||||
echo "PINNIPED_GCP_PROJECT env var must be set"
|
||||
exit 1
|
||||
|
||||
@@ -19,7 +19,7 @@ function set_pipeline() {
|
||||
"$ROOT_DIR"/hack/setup-fly.sh
|
||||
|
||||
# Ensure that the user is authenticated with gcloud.
|
||||
if [[ -z "$(gcloud config list account --format "value(core.account)")" ]]; then
|
||||
if ! gcloud auth print-access-token &>/dev/null; then
|
||||
echo "Please run \`gcloud auth login\` and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
# To be run before local integration tests.
|
||||
# From the pinniped repo:
|
||||
# hack/prepare-for-integration-tests.sh --get-active-directory-vars "../pinniped-ci-branch/hack/get-aws-ad-env-vars.sh"
|
||||
if [[ -z "$(gcloud config list account --format "value(core.account)")" ]]; then
|
||||
echo "Please run \`gcloud auth login\`"
|
||||
if ! gcloud auth print-access-token &>/dev/null; then
|
||||
echo "Please run \`gcloud auth login\` and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
# To be run before local integration tests.
|
||||
# From the pinniped repo:
|
||||
# hack/prepare-for-integration-tests.sh --get-github-vars "../pinniped-ci-branch/hack/get-github-env-vars.sh"
|
||||
if [[ -z "$(gcloud config list account --format "value(core.account)")" ]]; then
|
||||
echo "Please run \`gcloud auth login\`"
|
||||
if ! gcloud auth print-access-token &>/dev/null; then
|
||||
echo "Please run \`gcloud auth login\` and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Require two env vars.
|
||||
# Require env vars.
|
||||
if [[ -z "${GITHUB_CLIENT_ID:-}" ]]; then
|
||||
echo "GITHUB_CLIENT_ID env var must be set"
|
||||
exit 1
|
||||
@@ -14,7 +14,6 @@ if [[ -z "${GITHUB_CLIENT_SECRET:-}" ]]; then
|
||||
echo "GITHUB_CLIENT_SECRET env var must be set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${PINNIPED_GCP_PROJECT:-}" ]]; then
|
||||
echo "PINNIPED_GCP_PROJECT env var must be set"
|
||||
exit 1
|
||||
@@ -29,8 +28,8 @@ if ! command -v yq &>/dev/null; then
|
||||
echo "Please install the yq CLI"
|
||||
exit
|
||||
fi
|
||||
if [[ -z "$(gcloud config list account --format "value(core.account)")" ]]; then
|
||||
echo "Please run \`gcloud auth login\`"
|
||||
if ! gcloud auth print-access-token &>/dev/null; then
|
||||
echo "Please run \`gcloud auth login\` and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@@ -31,8 +31,14 @@ if ! command -v terraform &>/dev/null; then
|
||||
echo "Please install the terraform CLI"
|
||||
exit
|
||||
fi
|
||||
if [[ -z "$(gcloud config list account --format "value(core.account)")" ]]; then
|
||||
echo "Please run \`gcloud auth login\`"
|
||||
# This is needed for running gcloud commands.
|
||||
if ! gcloud auth print-access-token &>/dev/null; then
|
||||
echo "Please run \`gcloud auth login\` and try again."
|
||||
exit 1
|
||||
fi
|
||||
# This is needed for running terraform commands.
|
||||
if ! gcloud auth application-default print-access-token --quiet &>/dev/null; then
|
||||
echo "Please run \`gcloud auth application-default login\` and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@@ -36,8 +36,14 @@ if ! command -v terraform &>/dev/null; then
|
||||
echo "Please install the terraform CLI"
|
||||
exit
|
||||
fi
|
||||
if [[ -z "$(gcloud config list account --format "value(core.account)")" ]]; then
|
||||
echo "Please run \`gcloud auth login\`"
|
||||
# This is needed for running gcloud commands.
|
||||
if ! gcloud auth print-access-token &>/dev/null; then
|
||||
echo "Please run \`gcloud auth login\` and try again."
|
||||
exit 1
|
||||
fi
|
||||
# This is needed for running terraform commands.
|
||||
if ! gcloud auth application-default print-access-token --quiet &>/dev/null; then
|
||||
echo "Please run \`gcloud auth application-default login\` and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@@ -36,8 +36,14 @@ if ! command -v terraform &>/dev/null; then
|
||||
echo "Please install the terraform CLI"
|
||||
exit
|
||||
fi
|
||||
if [[ -z "$(gcloud config list account --format "value(core.account)")" ]]; then
|
||||
echo "Please run \`gcloud auth login\`"
|
||||
# This is needed for running gcloud commands.
|
||||
if ! gcloud auth print-access-token &>/dev/null; then
|
||||
echo "Please run \`gcloud auth login\` and try again."
|
||||
exit 1
|
||||
fi
|
||||
# This is needed for running terraform commands.
|
||||
if ! gcloud auth application-default print-access-token --quiet &>/dev/null; then
|
||||
echo "Please run \`gcloud auth application-default login\` and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user