#!/usr/bin/env bash DIR=$(cd $(dirname $0)/..; pwd) # See `script/build-e2e` DASHBOARD_DIST=${DIR}/dist EMBER_DIST=${DIR}/dist_ember # Image version RANCHER_IMG_VERSION=v2.9-head HAS_ARGS="false" # check if script invoke contains any argument. If so, adjust RANCHER_IMG_VERSION if [ $# -eq 1 ]; then RANCHER_IMG_VERSION=$1 HAS_ARGS="true" fi if [ "$HAS_ARGS" == "false" ]; then # this flow is what test.yaml is expected to to be following echo "normal flow without args. Defaults to v2.9-head" docker run -d --restart=unless-stopped -p 80:80 -p 443:443 \ -v ${DASHBOARD_DIST}:/usr/share/rancher/ui-dashboard/dashboard \ -v ${EMBER_DIST}:/usr/share/rancher/ui \ -e CATTLE_UI_OFFLINE_PREFERRED=true \ -e CATTLE_BOOTSTRAP_PASSWORD=password \ -e CATTLE_PASSWORD_MIN_LENGTH=3 \ --name cypress \ --privileged \ rancher/rancher:${RANCHER_IMG_VERSION} else # We will only hit this scenario for the extensions-compatibility-tests workflow and if it's not a -head version echo "special flow with version arg... RANCHER_IMG_VERSION=${RANCHER_IMG_VERSION}" docker run -d --restart=unless-stopped -p 80:80 -p 443:443 \ -e CATTLE_UI_OFFLINE_PREFERRED=true \ -e CATTLE_BOOTSTRAP_PASSWORD=password \ -e CATTLE_PASSWORD_MIN_LENGTH=3 \ --name cypress \ --privileged \ rancher/rancher:${RANCHER_IMG_VERSION} fi docker ps echo "Waiting for dashboard UI to be reachable (initial 20s wait) ..." sleep 20 echo "Waiting for dashboard UI to be reachable ..." okay=0 while [ $okay -lt 20 ]; do STATUS=$(curl --silent --head -k https://127.0.0.1/dashboard/ | awk '/^HTTP/{print $2}') echo "Status: $STATUS (Try: $okay)" okay=$((okay+1)) if [ "$STATUS" == "200" ]; then okay=100 else sleep 5 fi done if [ "$STATUS" != "200" ]; then echo "Dashboard did not become available in a reasonable time" exit 1 fi echo "Dashboard UI is ready"