github.com/deiscc/workflow-e2e@v0.0.0-20181208071258-117299af888f/docker-test-integration.sh (about)

     1  #!/usr/bin/env bash
     2  #
     3  # This program is suppsoed to be run inside the workflow-e2e docker container
     4  # to download the workflow CLI at runtime and run the integration tests.
     5  set -eo pipefail
     6  
     7  function debug {
     8  	if [ "${DEBUG_MODE}" == "true" ]; then
     9  		filename="/tmp/deis_debug"
    10  		touch "${filename}"
    11  		echo "Sleeping until ${filename} is deleted"
    12  
    13  		while [ -f "${filename}" ]
    14  		do
    15  			sleep 2
    16  		done
    17  	fi
    18  }
    19  
    20  trap debug ERR
    21  
    22  curl-cli-from-gcs-bucket() {
    23  	local gcs_bucket="${1}"
    24  	local base_url="https://storage.googleapis.com/${gcs_bucket}"
    25  	local url
    26  
    27  	case "${CLI_VERSION}" in
    28  		"latest" | "stable")
    29  			url="${base_url}"
    30  			;;
    31  		*)
    32  			url="${base_url}/${CLI_VERSION}"
    33  			;;
    34  	esac
    35  	url="${url}/deis-${CLI_VERSION}-linux-amd64"
    36  
    37  	# Download CLI, retry up to 5 times with 10 second delay between each
    38  	echo "Installing Workflow CLI version '${CLI_VERSION}' via url '${url}'"
    39  	curl -f --silent --show-error -I "${url}"
    40  	curl -f --silent --show-error --retry 5 --retry-delay 10 -o /usr/local/bin/deis "${url}"
    41  }
    42  
    43  # try multiple buckets for specific CLI_VERSION
    44  curl-cli-from-gcs-bucket "workflow-cli-master" || \
    45  curl-cli-from-gcs-bucket "workflow-cli-pr" || \
    46  curl-cli-from-gcs-bucket "workflow-cli-release"
    47  chmod +x /usr/local/bin/deis
    48  
    49  echo "Workflow CLI Version '$(deis --version)' installed."
    50  
    51  if [ "$TEST" == "bps" ]; then
    52  	make test-buildpacks
    53  	make test-dockerfiles
    54  else
    55  	make test-integration
    56  fi