File tree Expand file tree Collapse file tree 1 file changed +17
-10
lines changed
services/monitoring/grafana Expand file tree Collapse file tree 1 file changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -46,13 +46,20 @@ ensure-grafana-online:
4646 set +o allexport; \
4747 url=$$ {TF_VAR_GRAFANA_URL}; \
4848 echo " Waiting for grafana at $$ url to become reachable..." ; \
49- while true ; do \
50- status_code=$$(curl -k -o /dev/null -s -w "%{http_code}" $$url ) ; \
51- if [ " $$ status_code" -ge 200 ] && [ " $$ status_code" -lt 400 ]; then \
52- echo " Grafana is online" ; \
53- break ; \
54- else \
55- echo " Grafana still unreachable, waiting 5s for grafana to become reachable..." ; \
56- sleep 5; \
57- fi ; \
58- done;
49+ attempts=0; \
50+ max_attempts=10; \
51+ while [ $$ attempts -lt $$ max_attempts ]; do \
52+ status_code=$$(curl -k -o /dev/null -s -w "%{http_code}" $$url ) ; \
53+ if [ " $$ status_code" -ge 200 ] && [ " $$ status_code" -lt 400 ]; then \
54+ echo " Grafana is online" ; \
55+ break ; \
56+ else \
57+ echo " Grafana still unreachable, waiting 5s for grafana to become reachable... (Attempt $$ ((attempts+1)))" ; \
58+ sleep 5; \
59+ attempts=$$((attempts + 1 ) ); \
60+ fi ; \
61+ done ; \
62+ if [ $$ attempts -eq $$ max_attempts ]; then \
63+ echo " Max attempts reached, Grafana is still unreachable." ; \
64+ exit 1; \
65+ fi ;
You can’t perform that action at this time.
0 commit comments