Commit e666a49d authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

fix(readiness): call after url is determined; example uses $environment_url

parent b3dd0ef4
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -685,8 +685,7 @@ force_rollout $environment_name

This script - when found by the template - is used to wait & check for the application to be ready.

It uses the [GitLab CI variable](https://docs.gitlab.com/ee/ci/variables/predefined_variables.html) `$CI_ENVIRONMENT_URL`
to build absolute urls to the application.
It uses the template variable `$environment_url` to build absolute urls to the application.

It is supposed to exit with  status 0 on success (the template will go on with deployment), or any non-0 value in case
of error (the template will stop and as much as possible revert the ongoing deployment).
@@ -696,7 +695,7 @@ of error (the template will stop and as much as possible revert the ongoing depl
for attempt in {1..20}
do
    echo "Testing application readiness ($attempt/20)..."
    if wget --no-check-certificate -T 2 --tries 1 "$CI_ENVIRONMENT_URL/healthcheck"
    if wget --no-check-certificate -T 2 --tries 1 "$environment_url/healthcheck"
    then
        echo "[INFO] healthcheck response: OK"
        exit 0
+2 −2
Original line number Diff line number Diff line
@@ -410,8 +410,6 @@ stages:
      post_apply
    fi

    check_readiness

    # finally persist environment url
    if [[ -f environment_url.txt ]]
    then
@@ -422,6 +420,8 @@ stages:
      echo "$environment_url" > environment_url.txt
    fi
    echo -e "environment_type=$environment_type\\nenvironment_name=$environment_name\\nenvironment_url=$environment_url" > openshift.env

    check_readiness
  }

  # $1 deployment name