From d2a5e28004963062bacc79687ff4fc14826639ee Mon Sep 17 00:00:00 2001 From: Rob Cannon Date: Thu, 23 Jan 2020 14:47:14 -0500 Subject: [PATCH] fix: Removed dependency on jq from wait-for-cluster.sh script (#402) * Removed need for jq in wait-for-cluster.sh script * Updated all wait-for-cluster.sh scripts * Fixing SC2086 warning Co-authored-by: Morgante Pell --- autogen/main/scripts/wait-for-cluster.sh | 10 ++++------ .../scripts/wait-for-cluster.sh | 10 ++++------ .../beta-private-cluster/scripts/wait-for-cluster.sh | 10 ++++------ .../beta-public-cluster/scripts/wait-for-cluster.sh | 10 ++++------ .../scripts/wait-for-cluster.sh | 10 ++++------ modules/private-cluster/scripts/wait-for-cluster.sh | 10 ++++------ scripts/wait-for-cluster.sh | 10 ++++------ 7 files changed, 28 insertions(+), 42 deletions(-) diff --git a/autogen/main/scripts/wait-for-cluster.sh b/autogen/main/scripts/wait-for-cluster.sh index b7019eace..6b715f70e 100755 --- a/autogen/main/scripts/wait-for-cluster.sh +++ b/autogen/main/scripts/wait-for-cluster.sh @@ -22,17 +22,15 @@ fi PROJECT=$1 CLUSTER_NAME=$2 -gcloud_command="gcloud container clusters list --project=$PROJECT --format=json" -jq_query=".[] | select(.name==\"$CLUSTER_NAME\") | .status" -echo "Waiting for cluster $2 in project $1 to reconcile..." +echo "Waiting for cluster $CLUSTER_NAME in project $PROJECT to reconcile..." -current_status=$($gcloud_command | jq -r "$jq_query") +current_status=$(gcloud container clusters list --project="$PROJECT" --filter=name:"$CLUSTER_NAME" --format="value(status)") -while [[ "${current_status}" == "RECONCILING" ]]; do +while [[ "$current_status" == "RECONCILING" ]]; do printf "." sleep 5 - current_status=$($gcloud_command | jq -r "$jq_query") + current_status=$(gcloud container clusters list --project="$PROJECT" --filter=name:"$CLUSTER_NAME" --format="value(status)") done echo "Cluster is ready!" diff --git a/modules/beta-private-cluster-update-variant/scripts/wait-for-cluster.sh b/modules/beta-private-cluster-update-variant/scripts/wait-for-cluster.sh index b7019eace..6b715f70e 100755 --- a/modules/beta-private-cluster-update-variant/scripts/wait-for-cluster.sh +++ b/modules/beta-private-cluster-update-variant/scripts/wait-for-cluster.sh @@ -22,17 +22,15 @@ fi PROJECT=$1 CLUSTER_NAME=$2 -gcloud_command="gcloud container clusters list --project=$PROJECT --format=json" -jq_query=".[] | select(.name==\"$CLUSTER_NAME\") | .status" -echo "Waiting for cluster $2 in project $1 to reconcile..." +echo "Waiting for cluster $CLUSTER_NAME in project $PROJECT to reconcile..." -current_status=$($gcloud_command | jq -r "$jq_query") +current_status=$(gcloud container clusters list --project="$PROJECT" --filter=name:"$CLUSTER_NAME" --format="value(status)") -while [[ "${current_status}" == "RECONCILING" ]]; do +while [[ "$current_status" == "RECONCILING" ]]; do printf "." sleep 5 - current_status=$($gcloud_command | jq -r "$jq_query") + current_status=$(gcloud container clusters list --project="$PROJECT" --filter=name:"$CLUSTER_NAME" --format="value(status)") done echo "Cluster is ready!" diff --git a/modules/beta-private-cluster/scripts/wait-for-cluster.sh b/modules/beta-private-cluster/scripts/wait-for-cluster.sh index b7019eace..6b715f70e 100755 --- a/modules/beta-private-cluster/scripts/wait-for-cluster.sh +++ b/modules/beta-private-cluster/scripts/wait-for-cluster.sh @@ -22,17 +22,15 @@ fi PROJECT=$1 CLUSTER_NAME=$2 -gcloud_command="gcloud container clusters list --project=$PROJECT --format=json" -jq_query=".[] | select(.name==\"$CLUSTER_NAME\") | .status" -echo "Waiting for cluster $2 in project $1 to reconcile..." +echo "Waiting for cluster $CLUSTER_NAME in project $PROJECT to reconcile..." -current_status=$($gcloud_command | jq -r "$jq_query") +current_status=$(gcloud container clusters list --project="$PROJECT" --filter=name:"$CLUSTER_NAME" --format="value(status)") -while [[ "${current_status}" == "RECONCILING" ]]; do +while [[ "$current_status" == "RECONCILING" ]]; do printf "." sleep 5 - current_status=$($gcloud_command | jq -r "$jq_query") + current_status=$(gcloud container clusters list --project="$PROJECT" --filter=name:"$CLUSTER_NAME" --format="value(status)") done echo "Cluster is ready!" diff --git a/modules/beta-public-cluster/scripts/wait-for-cluster.sh b/modules/beta-public-cluster/scripts/wait-for-cluster.sh index b7019eace..6b715f70e 100755 --- a/modules/beta-public-cluster/scripts/wait-for-cluster.sh +++ b/modules/beta-public-cluster/scripts/wait-for-cluster.sh @@ -22,17 +22,15 @@ fi PROJECT=$1 CLUSTER_NAME=$2 -gcloud_command="gcloud container clusters list --project=$PROJECT --format=json" -jq_query=".[] | select(.name==\"$CLUSTER_NAME\") | .status" -echo "Waiting for cluster $2 in project $1 to reconcile..." +echo "Waiting for cluster $CLUSTER_NAME in project $PROJECT to reconcile..." -current_status=$($gcloud_command | jq -r "$jq_query") +current_status=$(gcloud container clusters list --project="$PROJECT" --filter=name:"$CLUSTER_NAME" --format="value(status)") -while [[ "${current_status}" == "RECONCILING" ]]; do +while [[ "$current_status" == "RECONCILING" ]]; do printf "." sleep 5 - current_status=$($gcloud_command | jq -r "$jq_query") + current_status=$(gcloud container clusters list --project="$PROJECT" --filter=name:"$CLUSTER_NAME" --format="value(status)") done echo "Cluster is ready!" diff --git a/modules/private-cluster-update-variant/scripts/wait-for-cluster.sh b/modules/private-cluster-update-variant/scripts/wait-for-cluster.sh index b7019eace..6b715f70e 100755 --- a/modules/private-cluster-update-variant/scripts/wait-for-cluster.sh +++ b/modules/private-cluster-update-variant/scripts/wait-for-cluster.sh @@ -22,17 +22,15 @@ fi PROJECT=$1 CLUSTER_NAME=$2 -gcloud_command="gcloud container clusters list --project=$PROJECT --format=json" -jq_query=".[] | select(.name==\"$CLUSTER_NAME\") | .status" -echo "Waiting for cluster $2 in project $1 to reconcile..." +echo "Waiting for cluster $CLUSTER_NAME in project $PROJECT to reconcile..." -current_status=$($gcloud_command | jq -r "$jq_query") +current_status=$(gcloud container clusters list --project="$PROJECT" --filter=name:"$CLUSTER_NAME" --format="value(status)") -while [[ "${current_status}" == "RECONCILING" ]]; do +while [[ "$current_status" == "RECONCILING" ]]; do printf "." sleep 5 - current_status=$($gcloud_command | jq -r "$jq_query") + current_status=$(gcloud container clusters list --project="$PROJECT" --filter=name:"$CLUSTER_NAME" --format="value(status)") done echo "Cluster is ready!" diff --git a/modules/private-cluster/scripts/wait-for-cluster.sh b/modules/private-cluster/scripts/wait-for-cluster.sh index b7019eace..6b715f70e 100755 --- a/modules/private-cluster/scripts/wait-for-cluster.sh +++ b/modules/private-cluster/scripts/wait-for-cluster.sh @@ -22,17 +22,15 @@ fi PROJECT=$1 CLUSTER_NAME=$2 -gcloud_command="gcloud container clusters list --project=$PROJECT --format=json" -jq_query=".[] | select(.name==\"$CLUSTER_NAME\") | .status" -echo "Waiting for cluster $2 in project $1 to reconcile..." +echo "Waiting for cluster $CLUSTER_NAME in project $PROJECT to reconcile..." -current_status=$($gcloud_command | jq -r "$jq_query") +current_status=$(gcloud container clusters list --project="$PROJECT" --filter=name:"$CLUSTER_NAME" --format="value(status)") -while [[ "${current_status}" == "RECONCILING" ]]; do +while [[ "$current_status" == "RECONCILING" ]]; do printf "." sleep 5 - current_status=$($gcloud_command | jq -r "$jq_query") + current_status=$(gcloud container clusters list --project="$PROJECT" --filter=name:"$CLUSTER_NAME" --format="value(status)") done echo "Cluster is ready!" diff --git a/scripts/wait-for-cluster.sh b/scripts/wait-for-cluster.sh index b7019eace..6b715f70e 100755 --- a/scripts/wait-for-cluster.sh +++ b/scripts/wait-for-cluster.sh @@ -22,17 +22,15 @@ fi PROJECT=$1 CLUSTER_NAME=$2 -gcloud_command="gcloud container clusters list --project=$PROJECT --format=json" -jq_query=".[] | select(.name==\"$CLUSTER_NAME\") | .status" -echo "Waiting for cluster $2 in project $1 to reconcile..." +echo "Waiting for cluster $CLUSTER_NAME in project $PROJECT to reconcile..." -current_status=$($gcloud_command | jq -r "$jq_query") +current_status=$(gcloud container clusters list --project="$PROJECT" --filter=name:"$CLUSTER_NAME" --format="value(status)") -while [[ "${current_status}" == "RECONCILING" ]]; do +while [[ "$current_status" == "RECONCILING" ]]; do printf "." sleep 5 - current_status=$($gcloud_command | jq -r "$jq_query") + current_status=$(gcloud container clusters list --project="$PROJECT" --filter=name:"$CLUSTER_NAME" --format="value(status)") done echo "Cluster is ready!"