Skip to content

Commit

Permalink
Support kubernetes versions <=1.23 with a zero-or-one capture block
Browse files Browse the repository at this point in the history
  • Loading branch information
pega-talba authored and groundnuty committed Jan 7, 2025
1 parent 86a1afe commit 7fba999
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions wait_for.sh
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ get_job_state() {
kill -s TERM $TOP_PID
fi

# Extract number of <avtive>:<ready>:<succeeded>:<failed>
# Ignore the Ready number, as it will alwasy be less or equal to Active number
get_job_state_output1=$(printf "%s" "$get_job_state_output" | sed -nr 's#.*:[[:blank:]]+([[:digit:]]+) [[:alpha:]]+ \(+([[:digit:]]+) [[:alpha:]]+\) / ([[:digit:]]+) [[:alpha:]]+ / ([[:digit:]]+) [[:alpha:]]+.*#\1:\3:\4#p' 2>&1)
# Extract number of <active>:<succeeded>:<failed>
# Ignore the Ready number if it exists, as it will always be less or equal to Active number
get_job_state_output1=$(printf "%s" "$get_job_state_output" | sed -nr 's#.*:[[:blank:]]+([[:digit:]]+) [[:alpha:]]+ (\(+[[:digit:]]+ [[:alpha:]]+\) )?/ ([[:digit:]]+) [[:alpha:]]+ / ([[:digit:]]+) [[:alpha:]]+.*#\1:\3:\4#p' 2>&1)
if [ $? -ne 0 ]; then
echo "$get_job_state_output" >&2
echo "$get_job_state_output1" >&2
Expand All @@ -185,7 +185,7 @@ get_job_state() {
echo "${get_job_state_output1}" >&2
fi

# Map triplets of <avtive>:<succeeded>:<failed> to not ready (emit 1) state
# Map triplets of <active>:<succeeded>:<failed> to not ready (emit 1) state
if [ $TREAT_ERRORS_AS_READY -eq 0 ]; then
# Two conditions:
# - pods are distributed between all 3 states with at least 1 pod active - then emit 1
Expand Down

0 comments on commit 7fba999

Please sign in to comment.