From 4bf6ffcf3f5aa90871dc7dc9972745b2551ee16f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Bourr=C3=A9?= Date: Sun, 6 Jan 2019 14:15:54 +0100 Subject: [PATCH] Wait if error 502 --- scripts/change_url | 11 ++++++++++- scripts/upgrade | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 329007f..48f5f76 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -121,5 +121,14 @@ systemctl reload nginx #Fix for the CI if sudo grep -qa container=lxc /proc/1/environ; then - sleep 60; + status_code=$(curl -s -o /dev/null -w '%{http_code}' "$domain${path_url%/}") + inc=0 + + # Have to wait the time that gitlab reload + while [ $status_code == "502" ] || [ $inc > 10 ] + do + sleep 10; + status_code=$(curl -s -o /dev/null -w '%{http_code}' "$domain${path_url%/}") + ((inc++)) + done; fi; \ No newline at end of file diff --git a/scripts/upgrade b/scripts/upgrade index 6480e91..dfed463 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -99,5 +99,14 @@ systemctl reload nginx #Fix for the CI if sudo grep -qa container=lxc /proc/1/environ; then - sleep 60; + status_code=$(curl -s -o /dev/null -w '%{http_code}' "$domain${path_url%/}") + inc=0 + + # Have to wait the time that gitlab reload + while [ $status_code == "502" ] || [ $inc > 10 ] + do + sleep 10; + status_code=$(curl -s -o /dev/null -w '%{http_code}' "$domain${path_url%/}") + ((inc++)) + done; fi; \ No newline at end of file