Skip to content

Commit 5eac450

Browse files
committed
Adds retry loop to health check
1 parent 3042bcd commit 5eac450

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

Jenkinsfile

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -356,16 +356,21 @@ spec:
356356
URL="http://${INGRESS_HOST}"
357357
fi
358358
359-
# sleep for 10 seconds to allow enough time for the server to start
360-
sleep 30
359+
sleep_countdown=5
361360
362-
if [[ $(curl -sL -w "%{http_code}\\n" "${URL}/health" -o /dev/null --connect-timeout 3 --max-time 5 --retry 3 --retry-max-time 30) == "200" ]]; then
363-
echo "Successfully reached health endpoint: ${URL}/health"
364-
echo "====================================================================="
365-
else
366-
echo "Could not reach health endpoint: ${URL}/health"
367-
exit 1;
368-
fi;
361+
# sleep for 10 seconds to allow enough time for the server to start
362+
sleep 10
363+
while [ $(curl -sL -w "%{http_code}\\n" "${URL}/health" -o /dev/null --connect-timeout 3 --max-time 5 --retry 3 --retry-max-time 30) != "200" ]; do
364+
sleep 30
365+
sleep_countdown=$((sleep_countdown-1))
366+
if [ sleep_countdown=0 ]; then
367+
echo "Could not reach health endpoint: ${URL}/health"
368+
exit 1;
369+
fi
370+
done
371+
372+
echo "Successfully reached health endpoint: ${URL}/health"
373+
echo "====================================================================="
369374
'''
370375
}
371376
stage('Package Helm Chart') {

0 commit comments

Comments
 (0)