From f55990195f6c3edf40d808270b38fd52564d77f9 Mon Sep 17 00:00:00 2001 From: Ryan Richard Date: Thu, 31 Jul 2025 12:07:05 -0700 Subject: [PATCH] auth before waiting for running GKE operations to finish --- pipelines/shared-tasks/remove-gke-cluster/task.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pipelines/shared-tasks/remove-gke-cluster/task.sh b/pipelines/shared-tasks/remove-gke-cluster/task.sh index 47259f96e..8b21b94d7 100755 --- a/pipelines/shared-tasks/remove-gke-cluster/task.sh +++ b/pipelines/shared-tasks/remove-gke-cluster/task.sh @@ -18,6 +18,8 @@ if [[ -z $zone || "$CLUSTER_NAME" != *"-zone-"* ]]; then exit 1 fi +gcloud auth activate-service-account "$GCP_SERVICE_ACCOUNT" --key-file <(echo "$GCP_JSON_KEY") --project "$GCP_PROJECT" + for i in $(seq 1 10); do echo "Checking $CLUSTER_NAME for ongoing operations (iteration $i)...." running_ops=$(gcloud container operations list --filter="targetLink:$CLUSTER_NAME AND status != done" --project "$GCP_PROJECT" --zone "$zone" --format yaml) @@ -31,5 +33,4 @@ for i in $(seq 1 10); do done echo "Removing $CLUSTER_NAME..." -gcloud auth activate-service-account "$GCP_SERVICE_ACCOUNT" --key-file <(echo "$GCP_JSON_KEY") --project "$GCP_PROJECT" gcloud container clusters delete "$CLUSTER_NAME" --zone "$zone" --quiet