File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -113,7 +113,27 @@ runs:
113113
114114 URL=$(platform env:url -1 --pipe)
115115
116- CURL_HTTP_STATUS=$(curl -L -s -o /dev/null -w "%{http_code}" $URL)
116+ MAX_CURL_TRIES=5
117+ CURL_SLEEP_SECONDS=5
118+ CURL_TRIES=0
119+ CURL_HTTP_STATUS=000
120+
121+ while [ "$CURL_TRIES" -lt "$MAX_CURL_TRIES" ]; do
122+ CURL_TRIES=$((CURL_TRIES+1))
123+
124+ CURL_HTTP_STATUS=$(curl -L -s -o /dev/null -w "%{http_code}" "$URL" || echo "000")
125+
126+ echo "cURL attempt $CURL_TRIES/$MAX_CURL_TRIES returned HTTP $CURL_HTTP_STATUS"
127+
128+ if [[ "$CURL_HTTP_STATUS" == "200" ]]; then
129+ break
130+ fi
131+
132+ if [ "$CURL_TRIES" -lt "$MAX_CURL_TRIES" ]; then
133+ echo "Waiting $CURL_SLEEP_SECONDS seconds before retrying CURL..."
134+ sleep "$CURL_SLEEP_SECONDS"
135+ fi
136+ done
117137
118138 if [[ "$CURL_HTTP_STATUS" != "200" ]]; then \
119139 echo "PlatformSH reports the environment is ready, but cURL could not connect to it. You may have pushed a broken build."; \
You can’t perform that action at this time.
0 commit comments