[fix-hyper-vendor] update hypercli in vendor
This commit is contained in:
82
vendor/github.com/hyperhq/hypercli/integration-cli/autotest/Dockerfile
generated
vendored
Normal file
82
vendor/github.com/hyperhq/hypercli/integration-cli/autotest/Dockerfile
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
FROM centos:7.3.1611
|
||||
|
||||
#This Dockerfile is used for autotest hypercli
|
||||
#REF: integration-cli/README.md
|
||||
|
||||
###################################
|
||||
## install common package ##
|
||||
###################################
|
||||
RUN yum install -y\
|
||||
automake \
|
||||
autoconf \
|
||||
make \
|
||||
gcc \
|
||||
wget \
|
||||
time \
|
||||
git \
|
||||
which \
|
||||
screen &&\
|
||||
yum clean all
|
||||
|
||||
|
||||
########################################
|
||||
## prepare java run env ##
|
||||
########################################
|
||||
RUN wget --no-check-certificate --no-cookies \
|
||||
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
|
||||
http://download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141-linux-x64.rpm \
|
||||
&& rpm -ivh jdk-8u141-linux-x64.rpm && rm -rf jdk-8u141-linux-x64.rpm
|
||||
|
||||
ENV JAVA_HOME /usr/java/jdk1.8.0_141
|
||||
ENV PATH $PATH:$JAVA_HOME/bin
|
||||
|
||||
|
||||
###########################
|
||||
## install golang ##
|
||||
###########################
|
||||
ENV GO_VERSION 1.8.3
|
||||
RUN wget http://golangtc.com/static/go/${GO_VERSION}/go${GO_VERSION}.linux-amd64.tar.gz
|
||||
RUN tar -xzf go${GO_VERSION}.linux-amd64.tar.gz -C /usr/local
|
||||
ENV GOROOT /usr/local/go
|
||||
ENV PATH $GOROOT/bin:$PATH
|
||||
|
||||
|
||||
##########################################
|
||||
## prepare jenkins slave run env ##
|
||||
##########################################
|
||||
ENV HOME /home/jenkins
|
||||
RUN groupadd -g 10000 jenkins
|
||||
RUN useradd -c "Jenkins user" -d $HOME -u 10000 -g 10000 -m jenkins
|
||||
RUN mkdir /home/jenkins/.tmp
|
||||
VOLUME ["/home/jenkins"]
|
||||
|
||||
WORKDIR $HOME
|
||||
USER root
|
||||
|
||||
################################
|
||||
## prepare for build env ##
|
||||
################################
|
||||
## Env
|
||||
ENV PATH /go/bin:/usr/local/go/bin:/usr/bin:/usr/local/bin:$PATH
|
||||
ENV GOPATH /go:/go/src/github.com/hyperhq/hypercli/integration-cli/vendor:/go/src/github.com/hyperhq/hypercli/vendor
|
||||
|
||||
#TARGET_REGION could be: us-west-1|eu-central-1|RegionOne
|
||||
ENV TARGET_REGION=${TARGET_REGION:-us-west-1}
|
||||
ENV BRANCH=${BRANCH:-master}
|
||||
ENV TEST_CASE_REG=${TEST_CASE_REG:-TestCli.*}
|
||||
|
||||
## hyper account for test
|
||||
ENV ACCESS_KEY=
|
||||
ENV SECRET_KEY=
|
||||
|
||||
## slack parameter
|
||||
ENV SLACK_TOKEN=
|
||||
ENV SLACK_CHANNEL_ID=
|
||||
|
||||
|
||||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
COPY script/slack.sh /usr/local/bin/slack.sh
|
||||
COPY script/run.sh /usr/local/bin/run.sh
|
||||
|
||||
ENTRYPOINT ["entrypoint.sh"]
|
||||
CMD ["run.sh"]
|
||||
3
vendor/github.com/hyperhq/hypercli/integration-cli/autotest/entrypoint.sh
generated
vendored
Executable file
3
vendor/github.com/hyperhq/hypercli/integration-cli/autotest/entrypoint.sh
generated
vendored
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
exec "$@"
|
||||
1
vendor/github.com/hyperhq/hypercli/integration-cli/autotest/etc/.gitignore
generated
vendored
Executable file
1
vendor/github.com/hyperhq/hypercli/integration-cli/autotest/etc/.gitignore
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
config
|
||||
17
vendor/github.com/hyperhq/hypercli/integration-cli/autotest/etc/config.template
generated
vendored
Executable file
17
vendor/github.com/hyperhq/hypercli/integration-cli/autotest/etc/config.template
generated
vendored
Executable file
@@ -0,0 +1,17 @@
|
||||
TARGET_REGION="us-west-1"
|
||||
BRANCH="master"
|
||||
TEST_CASE_REG="TestCli.*Basic"
|
||||
TIMEOUT="90m"
|
||||
|
||||
# hyper credentrial for test
|
||||
ACCESS_KEY=""
|
||||
SECRET_KEY=""
|
||||
|
||||
################################
|
||||
# slack token
|
||||
# https://api.slack.com/methods/workspace-tokens
|
||||
# https://api.slack.com/docs/token-types
|
||||
# https://api.slack.com/custom-integrations/legacy-tokens
|
||||
################################
|
||||
SLACK_TOKEN="xoxp-xxxxxxxxxxx"
|
||||
SLACK_CHANNEL_ID="C7AB6M1NJ" #hykins-monitor
|
||||
279
vendor/github.com/hyperhq/hypercli/integration-cli/autotest/script/run.sh
generated
vendored
Executable file
279
vendor/github.com/hyperhq/hypercli/integration-cli/autotest/script/run.sh
generated
vendored
Executable file
@@ -0,0 +1,279 @@
|
||||
#!/bin/bash
|
||||
|
||||
export HYPER_CONFIG=~/.hyper
|
||||
export DOCKER_REMOTE_DAEMON=1
|
||||
export DOCKER_CERT_PATH=fixtures/hyper_ssl
|
||||
export DOCKER_TLS_VERIFY=
|
||||
|
||||
#check hyper credentrial
|
||||
if [[ "${ACCESS_KEY}" == "" ]] || [[ "${SECRET_KEY}" == "" ]];then
|
||||
echo "Error: Please set ACCESS_KEY and SECRET_KEY"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
if [ "${TARGET_REGION}" = "eu-central-1" ]
|
||||
then
|
||||
#test eu1 with zl2 container
|
||||
export TARGET_NAME="eu1"
|
||||
export REGION="eu-central-1"
|
||||
export DOCKER_HOST="tcp://${REGION}.hyper.sh:443"
|
||||
elif [ "${TARGET_REGION}" = "us-west-1" ]
|
||||
then
|
||||
#test zl2 with eu1 container
|
||||
export TARGET_NAME="zl2"
|
||||
export REGION="us-west-1"
|
||||
export DOCKER_HOST="tcp://${REGION}.hyper.sh:443"
|
||||
elif [ "${TARGET_REGION}" = "RegionOne" ]
|
||||
then
|
||||
#test packet with zl2 container
|
||||
export TARGET_NAME="pkt"
|
||||
export REGION="RegionOne"
|
||||
export DOCKER_HOST="tcp://147.75.195.39:6443"
|
||||
else
|
||||
echo "unknow TARGET_REGION:${TARGET_REGION}"
|
||||
exit 1
|
||||
fi
|
||||
TITLE="*hypercli integration auto-test for \`${TARGET_NAME}\`* - ${BEGIN_TIME} *\`${TEST_CASE_REG}\`*"
|
||||
|
||||
|
||||
# job url
|
||||
JOB_URL="http://ci.hypercontainer.io:8080/job/${JOB_NAME}/${BUILD_NUMBER}/console"
|
||||
echo "JOB_URL: ${JOB_URL}"
|
||||
|
||||
# branch url
|
||||
PR_PRE=$(expr substr ${BRANCH} 1 1)
|
||||
if [ "$PR_PRE" = "#" ]
|
||||
then
|
||||
PR_NUMBER=$(echo ${BRANCH} | awk '{print substr($1,2)}')
|
||||
echo "========== Task: test PR ${PR_NUMBER} =========="
|
||||
BRANCH_URL="https://github.com/hyperhq/hypercli/pull/${PR_NUMBER}/commits"
|
||||
else
|
||||
echo "========== Task: test BRANCH ${BRANCH} =========="
|
||||
BRANCH_URL="https://github.com/hyperhq/hypercli/commits/${BRANCH}"
|
||||
fi
|
||||
echo "BRANCH_URL: ${BRANCH_URL}"
|
||||
|
||||
#ensure config for hyper cli
|
||||
mkdir -p ${HYPER_CONFIG}
|
||||
cat > ${HYPER_CONFIG}/config.json <<EOF
|
||||
{
|
||||
"clouds": {
|
||||
"${DOCKER_HOST}": {
|
||||
"accesskey": "${ACCESS_KEY}",
|
||||
"secretkey": "${SECRET_KEY}",
|
||||
"region": "${REGION}"
|
||||
},
|
||||
"tcp://*.hyper.sh:443": {
|
||||
"accesskey": "${ACCESS_KEY}",
|
||||
"secretkey": "${SECRET_KEY}",
|
||||
"region": "${REGION}"
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
echo "========== config git proxy =========="
|
||||
if [ "${http_proxy}" != "" ];then
|
||||
git config --global http.proxy ${http_proxy}
|
||||
fi
|
||||
if [ "${https_proxy}" != "" ];then
|
||||
git config --global https.proxy ${https_proxy}
|
||||
fi
|
||||
git config --list | grep proxy
|
||||
|
||||
echo "========== ping github.com =========="
|
||||
ping -c 3 -W 10 github.com
|
||||
|
||||
echo "========== Clone hypercli repo =========="
|
||||
mkdir -p /go/src/github.com/{hyperhq,docker}
|
||||
cd /go/src/github.com/hyperhq
|
||||
git clone https://github.com/hyperhq/hypercli.git
|
||||
|
||||
echo "========== Build hypercli =========="
|
||||
cd /go/src/github.com/hyperhq/hypercli
|
||||
if [[ "${PR_PRE}" == "#" ]];then
|
||||
echo "checkout pr :#${PR_NUMBER}"
|
||||
git fetch origin pull/${PR_NUMBER}/head:pr-${PR_NUMBER}
|
||||
git checkout pr-${PR_NUMBER}
|
||||
else
|
||||
echo "checkout branch :${BRANCH}"
|
||||
git checkout ${BRANCH}
|
||||
fi
|
||||
|
||||
if [[ $? -ne 0 ]];then
|
||||
echo "Branch ${BRANCH} not exist!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
./build.sh
|
||||
if [ $? -ne 0 ];then
|
||||
echo "Build hypercli failed"
|
||||
exit 1
|
||||
fi
|
||||
ln -s /go/src/github.com/hyperhq/hypercli /go/src/github.com/docker/docker
|
||||
ln -s /go/src/github.com/hyperhq/hypercli/hyper/hyper /usr/bin/hyper
|
||||
echo alias hypercli=\"hyper --region \${DOCKER_HOST}\" >> ~/.bashrc
|
||||
source ~/.bashrc
|
||||
|
||||
echo "##############################################################################################"
|
||||
echo "## Welcome to integration test ##"
|
||||
echo "##############################################################################################"
|
||||
#show config for hyper cli
|
||||
echo "Current hyper config: ${HYPER_CONFIG}/config.json"
|
||||
echo "----------------------------------------------------------------------------------------------"
|
||||
cat ${HYPER_CONFIG}/config.json \
|
||||
| sed 's/"secretkey":.*/"secretkey": "******************************",/g' \
|
||||
| sed 's/"auth":.*/"auth": "******************************"/g'
|
||||
echo "----------------------------------------------------------------------------------------------"
|
||||
|
||||
|
||||
## send begin message to slack
|
||||
COMMIT_SHORT_ID=$(git rev-parse --short HEAD)
|
||||
COMMIT_ID=$(git rev-parse HEAD)
|
||||
COMMIT_URL="https://github.com/hyperhq/hypercli/commit/${COMMIT_ID}"
|
||||
|
||||
ATT_LINK="LINK: GITHUB(<${BRANCH_URL}|${BRANCH}> - <${COMMIT_URL}|${COMMIT_SHORT_ID}>) JOB(<${JOB_URL}|${BUILD_NUMBER}>)"
|
||||
ATTACHMENT="[{'text':'$ATT_LINK'}]"
|
||||
MESSAGE="[BEGIN] - $TITLE"
|
||||
slack.sh "$MESSAGE" "$ATTACHMENT"
|
||||
|
||||
TEST_HOME="/go/src/github.com/hyperhq/hypercli/integration-cli"
|
||||
cd /go/src/github.com/hyperhq/hypercli/integration-cli
|
||||
|
||||
cat <<EOF
|
||||
##########################################
|
||||
DOCKER_HOST: ${DOCKER_HOST}
|
||||
REGION: ${REGION}
|
||||
BRANCH: ${BRANCH}
|
||||
TEST_HOME: ${TEST_HOME}
|
||||
TEST_CASE_REG: ${TEST_CASE_REG}
|
||||
SLACK_TOKEN: ${SLACK_TOKEN:0:15}-xxxxxxxxxxx
|
||||
SLACK_CHANNEL_ID: ${SLACK_CHANNEL_ID}
|
||||
##########################################
|
||||
EOF
|
||||
|
||||
echo "========================================="
|
||||
env
|
||||
echo "========================================="
|
||||
|
||||
##############################################
|
||||
# start test
|
||||
##############################################
|
||||
## first test
|
||||
LOG="test1.log"
|
||||
echo "====================first test(${TEST_CASE_REG} ${TIMEOUT} ${LOG})===================="
|
||||
rm -rf $LOG >/dev/null 2>&1
|
||||
script -ec "go test -check.f '${TEST_CASE_REG}' -timeout ${TIMEOUT:-90m}" | tee $LOG
|
||||
ls -l $LOG
|
||||
echo =========================
|
||||
|
||||
FAIL_COUNT1=`grep "^FAIL:" ${LOG} | wc -l`
|
||||
TEST_RESULT1=`grep -E "^(OK:|OOPS:)" ${LOG}`
|
||||
DURATION1=`grep -P "\tgithub.com/hyperhq/hypercli/integration-cli\t" ${LOG} | awk '{print $NF}'`
|
||||
|
||||
echo "----------get failed test case(1st)----------"
|
||||
FAILED_FILE=failed1.log
|
||||
cat ${LOG} | grep "^FAIL:" > ${FAILED_FILE}
|
||||
FAILED_TEST_CASE1=`cat ${FAILED_FILE} | awk -F. '{if(NR==1){CASE=$NF}else{CASE=CASE"|"$NF}}END{printf CASE}'`
|
||||
echo "-----------------------------------------"
|
||||
echo "FAILED_TEST_CASE1: $FAILED_TEST_CASE1"
|
||||
|
||||
|
||||
RETEST_CASE=""
|
||||
RETEST_COUNT="0"
|
||||
while read LINE
|
||||
do
|
||||
if [ "${TARGET_REGION}" = "RegionOne" ]
|
||||
then
|
||||
HAS_VOL=`echo ${LINE} | grep -i Volume 2>/dev/null | wc -l`
|
||||
HAS_FIP=`echo ${LINE} | grep -i Fip 2>/dev/null | wc -l`
|
||||
if [ $HAS_VOL -ne 0 -o $HAS_FIP -ne 0 ]
|
||||
then
|
||||
echo "[SKIP FOR PKT]: ${LINE}"
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
CASE_NAME=`echo ${LINE} | awk -F. '{printf $NF}'`
|
||||
if [ "${RETEST_CASE}" = "" ]
|
||||
then
|
||||
RETEST_CASE="$CASE_NAME"
|
||||
else
|
||||
RETEST_CASE="${RETEST_CASE}|$CASE_NAME"
|
||||
fi
|
||||
RETEST_COUNT=`expr $RETEST_COUNT + 1`
|
||||
done < ${FAILED_FILE}
|
||||
|
||||
echo "-----------------------------------------"
|
||||
echo "RETEST_CASE: ${RETEST_CASE}"
|
||||
echo "-----------------------------------------"
|
||||
|
||||
if [ $RETEST_COUNT -ne 0 ];then
|
||||
## second test
|
||||
LOG="test2.log"
|
||||
echo "====================second test(${RETEST_CASE} ${TIMEOUT} ${LOG})===================="
|
||||
rm -rf $LOG >/dev/null 2>&1
|
||||
script -ec "go test -check.f '${RETEST_CASE}' -timeout ${TIMEOUT:-90m}" | tee $LOG
|
||||
ls -l $LOG
|
||||
echo =========================
|
||||
|
||||
echo "----------get failed test case(2nd)----------"
|
||||
FAILED_FILE=failed2.log
|
||||
cat ${LOG} | grep "^FAIL:" > ${FAILED_FILE}
|
||||
FAILED_TEST_CASE2=`cat ${FAILED_FILE} | awk -F. '{if(NR==1){CASE=$NF}else{CASE=CASE"|"$NF}}END{printf CASE}'`
|
||||
echo "-----------------------------------------"
|
||||
echo "FAILED_TEST_CASE2: $FAILED_TEST_CASE2"
|
||||
|
||||
FAIL_COUNT2=`grep "^FAIL:" ${LOG} | wc -l`
|
||||
TEST_RESULT2=`grep -E "^(OK:|OOPS:)" ${LOG}`
|
||||
DURATION2=`grep -P "\tgithub.com/hyperhq/hypercli/integration-cli\t" ${LOG} | awk '{print $NF}'`
|
||||
|
||||
END_TIME=`date "+%Y/%m/%d %H:%M:%S"`
|
||||
if [ $FAIL_COUNT2 -ne 0 ];then
|
||||
icon=":scream:"
|
||||
if [ "${TEST_RESULT1}" = "" -o "${TEST_RESULT2}" = "" ];then
|
||||
icon=":exclamation:"
|
||||
fi
|
||||
ATTACHMENT="[{'text':'${ATT_LINK}'},{'text':'DURATION(1st): ${DURATION1}'},{'text':'TEST_RESULT(1st): ${TEST_RESULT1}'},{'text':'RE_TEST_CASE(2nd): ${RETEST_CASE}'},{'text':'DURATION(2nd): ${DURATION2}'},{'text':'TEST_RESULT(2nd): ${TEST_RESULT2}'},{'text':'FAILED_TEST_CASE(2nd): $FAILED_TEST_CASE2'}]"
|
||||
else
|
||||
icon=":smile:"
|
||||
ATTACHMENT="[{'text':'${ATT_LINK}'},{'text':'DURATION(1st): ${DURATION1}'},{'text':'TEST_RESULT(1st): ${TEST_RESULT1}'},{'text':'RE_TEST_CASE(2nd): ${RETEST_CASE}'},{'text':'DURATION(2nd): ${DURATION2}'},{'text':'TEST_RESULT(2nd): ${TEST_RESULT2}'}]"
|
||||
fi
|
||||
echo "ATTACHMENT(1):${ATTACHMENT}"
|
||||
MESSAGE="[END] - ${TITLE} :${icon} - ${END_TIME}"
|
||||
else
|
||||
END_TIME=`date "+%Y/%m/%d %H:%M:%S"`
|
||||
ATTACHMENT="[{'text':'${ATT_LINK}'},{'text':'DURATION: ${DURATION1}'},{'text':'TEST_RESULT: ${TEST_RESULT1}'}]"
|
||||
icon=":smile:"
|
||||
if [ "${TEST_RESULT1}" = "" ];then
|
||||
icon=":exclamation:"
|
||||
fi
|
||||
if [ $FAIL_COUNT1 -ne 0 ];then
|
||||
echo "first failed, second passed"
|
||||
icon=":scream:"
|
||||
ATTACHMENT="[{'text':'${ATT_LINK}'},{'text':'DURATION: ${DURATION1}'},{'text':'TEST_RESULT: ${TEST_RESULT1}'},{'text':'FAILED_TEST_CASE: $FAILED_TEST_CASE1'}]"
|
||||
fi
|
||||
echo "ATTACHMENT(2):${ATTACHMENT}"
|
||||
MESSAGE="[END] - ${TITLE} :${icon} - ${END_TIME}"
|
||||
fi
|
||||
|
||||
cat <<EOF
|
||||
--------------------------------------
|
||||
FAIL_COUNT1: ${FAIL_COUNT1}
|
||||
DURATION1: ${DURATION1}
|
||||
TEST_RESULT1: ${TEST_RESULT1}
|
||||
FAILED_TEST_CASE1: ${FAILED_TEST_CASE1}
|
||||
|
||||
RETEST_COUNT: ${RETEST_COUNT}
|
||||
RETEST_CASE: ${RETEST_CASE}
|
||||
|
||||
FAIL_COUNT2: ${FAIL_COUNT2}
|
||||
DURATION2: ${DURATION2}
|
||||
TEST_RESULT2: ${TEST_RESULT2}
|
||||
FAILED_TEST_CASE2: ${FAILED_TEST_CASE2}
|
||||
--------------------------------------
|
||||
MESSAGE: ${MESSAGE}
|
||||
ATTACHMENT: ${ATTACHMENT}
|
||||
EOF
|
||||
|
||||
slack.sh "${MESSAGE}" "${ATTACHMENT}"
|
||||
28
vendor/github.com/hyperhq/hypercli/integration-cli/autotest/script/slack.sh
generated
vendored
Executable file
28
vendor/github.com/hyperhq/hypercli/integration-cli/autotest/script/slack.sh
generated
vendored
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ "${SLACK_TOKEN}" == "" -o "${SLACK_CHANNEL_ID}" == "" ];then
|
||||
echo "SLACK_TOKEN or SLACK_CHANNEL_ID is unset, skip send slack message"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
NICK="HykinsBot"
|
||||
EMOJI=":jenkins:"
|
||||
|
||||
MESSAGE="$1"
|
||||
ATTACHMENT="$2"
|
||||
|
||||
curl -X POST \
|
||||
-F token=${SLACK_TOKEN} \
|
||||
-F channel=${SLACK_CHANNEL_ID} \
|
||||
-F "text=${MESSAGE}" \
|
||||
-F username=$NICK \
|
||||
-F "attachments=${ATTACHMENT}" \
|
||||
-F "icon_emoji=${EMOJI}" \
|
||||
https://slack.com/api/chat.postMessage
|
||||
|
||||
echo
|
||||
if [ $? -eq 0 ];then
|
||||
echo "send slack message OK :)"
|
||||
else
|
||||
echo "send slack message FAILED :("
|
||||
fi
|
||||
91
vendor/github.com/hyperhq/hypercli/integration-cli/autotest/util.sh
generated
vendored
Executable file
91
vendor/github.com/hyperhq/hypercli/integration-cli/autotest/util.sh
generated
vendored
Executable file
@@ -0,0 +1,91 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
if [ ! -f etc/config ];then
|
||||
cp etc/config.template etc/config
|
||||
echo "please config etc/config first"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
. etc/config
|
||||
|
||||
repo="hyperhq/hypercli-auto-test"
|
||||
tag="auto"
|
||||
image=${repo}:${tag}
|
||||
|
||||
|
||||
function build(){
|
||||
echo "starting build..."
|
||||
echo "=============================================================="
|
||||
docker build --build-arg http_proxy=${http_proxy} --build-arg https_proxy=${https_proxy} -t ${image} .
|
||||
}
|
||||
|
||||
function push(){
|
||||
|
||||
echo -e "\nstarting push [${image}] ..."
|
||||
echo "=============================================================="
|
||||
docker push ${image}
|
||||
}
|
||||
|
||||
function run(){
|
||||
CONFIG_FILE=$1
|
||||
if [ "${CONFIG_FILE}" != "" ];then
|
||||
if [ ! -f "${CONFIG_FILE}" ];then
|
||||
echo "${CONFIG_FILE} not found"
|
||||
exit 1
|
||||
else
|
||||
echo "use config: ${CONFIG_FILE}"
|
||||
. ${CONFIG_FILE}
|
||||
fi
|
||||
else
|
||||
echo "use default config: etc/config"
|
||||
fi
|
||||
docker run -it --rm \
|
||||
-e http_proxy="$http_proxy" \
|
||||
-e https_proxy="$https_proxy" \
|
||||
-e TARGET_REGION="$TARGET_REGION" \
|
||||
-e BRANCH="$BRANCH" \
|
||||
-e TEST_CASE_REG="$TEST_CASE_REG" \
|
||||
-e ACCESS_KEY="${ACCESS_KEY}" \
|
||||
-e SECRET_KEY="${SECRET_KEY}" \
|
||||
-e SLACK_TOKEN="${SLACK_TOKEN}" \
|
||||
-e SLACK_CHANNEL_ID="${SLACK_CHANNEL_ID}" \
|
||||
${image}
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
"push")
|
||||
build
|
||||
push
|
||||
;;
|
||||
"build")
|
||||
build
|
||||
;;
|
||||
"run")
|
||||
run "$2"
|
||||
;;
|
||||
*)
|
||||
cat <<EOF
|
||||
usage:
|
||||
./util.sh # show usage
|
||||
./util.sh build # build only
|
||||
./util.sh push # build and push
|
||||
./util.sh run <config> # run docker container
|
||||
|
||||
example:
|
||||
./util.sh run
|
||||
./util.sh run etc/config
|
||||
./util.sh run etc/config.zl2
|
||||
./util.sh run etc/config.eu1
|
||||
./util.sh run etc/config.pkt
|
||||
EOF
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
|
||||
echo -e "\n=============================================================="
|
||||
echo "Done!"
|
||||
|
||||
Reference in New Issue
Block a user