Skip to content

Commit

Permalink
fix: Removed dependency on jq from wait-for-cluster.sh script (#402)
Browse files Browse the repository at this point in the history
* 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 <morgante.pell@morgante.net>
  • Loading branch information
RobCannon and morgante committed Jan 23, 2020
1 parent 65071ef commit d2a5e28
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 42 deletions.
10 changes: 4 additions & 6 deletions autogen/main/scripts/wait-for-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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!"
Original file line number Diff line number Diff line change
Expand Up @@ -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!"
10 changes: 4 additions & 6 deletions modules/beta-private-cluster/scripts/wait-for-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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!"
10 changes: 4 additions & 6 deletions modules/beta-public-cluster/scripts/wait-for-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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!"
Original file line number Diff line number Diff line change
Expand Up @@ -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!"
10 changes: 4 additions & 6 deletions modules/private-cluster/scripts/wait-for-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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!"
10 changes: 4 additions & 6 deletions scripts/wait-for-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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!"

0 comments on commit d2a5e28

Please sign in to comment.