Commit e6937bda authored by Albert Salim's avatar Albert Salim

Merge branch 'alberts-fix-retry-url' into 'master'

Fix verify deployment retries

See merge request gitlab-org/gitlab!63715
parents 7af87dc3 b95eca3f
...@@ -367,7 +367,7 @@ EOF ...@@ -367,7 +367,7 @@ EOF
function verify_deploy() { function verify_deploy() {
echoinfo "Verifying deployment at ${CI_ENVIRONMENT_URL}" echoinfo "Verifying deployment at ${CI_ENVIRONMENT_URL}"
if wait_for_url "${CI_ENVIRONMENT_URL}" curl_output.txt; then if retry "test_url \"${CI_ENVIRONMENT_URL}\" curl_output.txt"; then
echoinfo "Review app is deployed to ${CI_ENVIRONMENT_URL}" echoinfo "Review app is deployed to ${CI_ENVIRONMENT_URL}"
return 0 return 0
else else
......
...@@ -13,16 +13,18 @@ function retry() { ...@@ -13,16 +13,18 @@ function retry() {
return 1 return 1
} }
function wait_for_url() { function test_url() {
local url="${1}" local url="${1}"
local curl_output="${2}" local curl_output="${2}"
local status
echo "Waiting for ${url}" status=$(curl -s -o "${curl_output}" -L -w ''%{http_code}'' "${url}")
timeout -s 1 60 bash -c \ if [[ $status == "200" ]]; then
'while [[ "$(curl -s -o ${1} -L -w ''%{http_code}'' ${0})" != "200" ]]; \ return 0
do echo "." && sleep 5; \ fi
done' ${url} ${curl_output}
return 1
} }
function bundle_install_script() { function bundle_install_script() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment