Skip to content

Commit

Permalink
Improvements to wait_for_pods function
Browse files Browse the repository at this point in the history
Signed-off-by: hbelmiro <[email protected]>
  • Loading branch information
hbelmiro committed Sep 3, 2024
1 parent 1232ab9 commit ea23e9a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions scripts/deploy/github/helper-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,15 @@ wait_for_pods () {
if [[ -z $pods ]]; then
echo "No pods found or error retrieving pods."
else
ready_pods=$(echo "$pods" | awk '$2 == $3 && ($3 == "Running" || $3 == "Completed") {print $0}')
num_pods=$(echo "$pods" | wc -l | xargs)
num_ready=$(echo "$ready_pods" | wc -l | xargs)
num_ready=0

while IFS= read -r pod; do
ready_status=$(echo "$pod" | awk '{print $2}')
if [[ "$ready_status" == "$(echo "$ready_status" | cut -d/ -f2)" ]]; then
num_ready=$((num_ready+1))
fi
done <<< "$pods"

local msg="${num_ready}/${num_pods} pods are ready in \"${namespace}\"."

Expand Down

0 comments on commit ea23e9a

Please sign in to comment.