#!/bin/bash env if [ "${REGION}" == "" ];then REGION="us-west-1" fi # set default value of DOCKER_HOST and BRANCH if [[ "$DOCKER_HOST" == "" ]];then DOCKER_HOST="tcp://us-west-1.hyper.sh:443" fi PR="" if [[ "${BRANCH:0:1}" == "#" ]];then PR=${BRANCH:1} BRANCH="" echo "========== Task: test PR #${PR} ==========" else if [[ "${BRANCH}" == "" ]];then BRANCH="master" fi echo "========== Task: test BRANCH ${BRANCH} ==========" fi if [[ "${ACCESS_KEY}" == "" ]] || [[ "${SECRET_KEY}" == "" ]];then echo "Error: Please set ACCESS_KEY and SECRET_KEY" exit 1 fi if [[ "$@" != "./build.sh" ]];then #ensure config for hyper cli mkdir -p ~/.hyper cat > ~/.hyper/config.json <> /root/.bashrc source /root/.bashrc echo "##############################################################################################" echo "## Welcome to integration test env ##" echo "##############################################################################################" #show config for hyper cli echo "Current hyper config: ~/.hyper/config.json" echo "----------------------------------------------------------------------------------------------" cat ~/.hyper/config.json \ | sed 's/"secretkey":.*/"secretkey": "******************************",/g' \ | sed 's/"auth":.*/"auth": "******************************"/g' echo "----------------------------------------------------------------------------------------------" fi #execute command if [[ $# -ne 0 ]];then echo "========== Test Cmd: $@ ==========" cd /go/src/github.com/hyperhq/hypercli/integration-cli && $@ if [[ "$@" == "./build.sh" ]];then #show make result if [[ $? -eq 0 ]];then echo "OK:)" else echo "Failed:(" fi fi fi