Commit 5ffa69e4 authored by Albert Salim's avatar Albert Salim

Wait for Rails to be ready

parent 94271657
......@@ -368,9 +368,7 @@ EOF
function verify_deploy() {
echoinfo "Verifying deployment at ${CI_ENVIRONMENT_URL}"
local status=$(curl -sL -w "%{http_code}\\n" "${CI_ENVIRONMENT_URL}" -o curl_output.txt)
if [[ $status == '200' ]]; then
if wait_for_url "${CI_ENVIRONMENT_URL}" curl_output.txt; then
echoinfo "Review app is deployed to ${CI_ENVIRONMENT_URL}"
return 0
else
......
......@@ -13,6 +13,18 @@ function retry() {
return 1
}
function wait_for_url() {
local url="${1}"
local curl_output="${2}"
echo "Waiting for ${url}"
timeout -s 1 60 bash -c \
'while [[ "$(curl -s -o ${1} -L -w ''%{http_code}'' ${0})" != "200" ]]; \
do echo "." && sleep 5; \
done' ${url} ${curl_output}
}
function bundle_install_script() {
local extra_install_args="${1}"
......
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