Commit b0685667 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'alberts-test-if-review-app-available' into 'master'

Verify review app deployment

See merge request gitlab-org/gitlab!63604
parents e018b2b4 5ffa69e4
...@@ -71,13 +71,16 @@ review-deploy: ...@@ -71,13 +71,16 @@ review-deploy:
- download_chart - download_chart
- date - date
- deploy || (display_deployment_debug && exit 1) - deploy || (display_deployment_debug && exit 1)
- verify_deploy || exit 1
- disable_sign_ups || (delete_release && exit 1) - disable_sign_ups || (delete_release && exit 1)
after_script: after_script:
# Run seed-dast-test-data.sh only when DAST_RUN is set to true. This is to pupulate review app with data for DAST scan. # Run seed-dast-test-data.sh only when DAST_RUN is set to true. This is to pupulate review app with data for DAST scan.
# Set DAST_RUN to true when jobs are manually scheduled. # Set DAST_RUN to true when jobs are manually scheduled.
- if [ "$DAST_RUN" == "true" ]; then source scripts/review_apps/seed-dast-test-data.sh; TRACE=1 trigger_proj_user_creation; fi - if [ "$DAST_RUN" == "true" ]; then source scripts/review_apps/seed-dast-test-data.sh; TRACE=1 trigger_proj_user_creation; fi
artifacts: artifacts:
paths: [environment_url.txt] paths:
- environment_url.txt
- curl_output.txt
expire_in: 7 days expire_in: 7 days
when: always when: always
......
...@@ -364,6 +364,18 @@ EOF ...@@ -364,6 +364,18 @@ EOF
eval "${HELM_CMD}" eval "${HELM_CMD}"
} }
function verify_deploy() {
echoinfo "Verifying deployment at ${CI_ENVIRONMENT_URL}"
if wait_for_url "${CI_ENVIRONMENT_URL}" curl_output.txt; then
echoinfo "Review app is deployed to ${CI_ENVIRONMENT_URL}"
return 0
else
echoerr "Review app is not available at ${CI_ENVIRONMENT_URL}. See curl_output.txt artifact for detail."
return 1
fi
}
function display_deployment_debug() { function display_deployment_debug() {
local namespace="${CI_ENVIRONMENT_SLUG}" local namespace="${CI_ENVIRONMENT_SLUG}"
local release="${CI_ENVIRONMENT_SLUG}" local release="${CI_ENVIRONMENT_SLUG}"
......
...@@ -13,6 +13,18 @@ function retry() { ...@@ -13,6 +13,18 @@ function retry() {
return 1 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() { function bundle_install_script() {
local extra_install_args="${1}" 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