Skip to content

Commit 2c1e27b

Browse files
Newline in echo, error if bad cert status
1 parent 47c0b62 commit 2c1e27b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

.github/workflows/test-kubernetes.yaml

+10-2
Original file line numberDiff line numberDiff line change
@@ -118,21 +118,29 @@ jobs:
118118
sleep 30
119119
done
120120
121+
# This step can time out, but it timing out doesn't necessarily mean that the webhook is not working.
122+
# Timeouts mainly happen due to the environment of the runner and/or parallelism, thus such occurrences will simply be dismissed as warnings.
121123
- name: Check the certificate status
122124
run: |
123125
max_wait_time_seconds=300
124126
end=$(( $(date +%s) + $max_wait_time_seconds ))
125127
start=$(date +%s)
126128
127129
while [ $(date +%s) -le $end ]; do
128-
kubectl get certificate/dnsimple-test -o jsonpath='{.status}'
130+
OUT=$(kubectl get certificate/dnsimple-test -o jsonpath='{.status.conditions}')
131+
echo -e "$OUT\n"
132+
133+
if [ $(echo "$OUT" | grep -iE "Failed|Denied" | wc -l) -gt 0 ]; then
134+
echo "::Error title=Certificate resource errored::The certificate ressource has an error"
135+
exit 1
136+
fi
129137
130138
if [ $(kubectl get certificate dnsimple-test -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}') == "True" ]; then
131139
echo "Certificate is ready after $(( $(date +%s) - $start )) seconds"
132140
exit 0
133141
fi
134142
sleep 10
135-
echo "[i] New iteration at $(date)"
143+
echo -e "\n[i] New iteration at $(date)"
136144
done
137145
138146
echo "::warning title=Certificate timed out::Have timed out waiting for certificate"

0 commit comments

Comments
 (0)