xci: Enable deployment and testing for post merge jobs
[releng.git] / jjb / container4nfv / arm64 / yardstick-arm64.sh
1 #!/bin/bash
2 set -e
3
4 sshpass -p root ssh root@10.1.0.50 \
5   "mkdir -p /etc/yardstick; rm -rf /etc/yardstick/admin.conf"
6
7
8 sshpass -p root ssh root@10.1.0.50 \
9   kubectl config set-cluster yardstick --server=127.0.0.1:8080 --insecure-skip-tls-verify=true --kubeconfig=/etc/yardstick/admin.conf
10 sshpass -p root ssh root@10.1.0.50 \
11   kubectl config set-context yardstick --cluster=yardstick --kubeconfig=/etc/yardstick/admin.conf
12 sshpass -p root ssh root@10.1.0.50 \
13   kubectl config use-context yardstick --kubeconfig=/etc/yardstick/admin.conf 
14
15
16
17 if [ ! -n "$redirect" ]; then
18   redirect="/dev/stdout"
19 fi
20
21 if [ ! -n "$DOCKER_TAG" ]; then
22   DOCKER_TAG='latest'
23 fi
24
25 if [ ! -n "$NODE_NAME" ]; then
26   NODE_NAME='arm-virutal03'
27 fi
28
29 if [ ! -n "$DEPLOY_SCENARIO" ]; then
30   DEPLOY_SCENARIO='k8-nosdn-lb-noha_daily'
31 fi
32
33 if [ ! -n "$YARDSTICK_DB_BACKEND" ]; then
34   YARDSTICK_DB_BACKEND='-i 104.197.68.199:8086'
35 fi
36
37 # Pull the image with correct tag
38 DOCKER_REPO='opnfv/yardstick'
39 if [ "$(uname -m)" = 'aarch64' ]; then
40     DOCKER_REPO="${DOCKER_REPO}_$(uname -m)"
41 fi
42 echo "Yardstick: Pulling image ${DOCKER_REPO}:${DOCKER_TAG}"
43 sshpass -p root ssh root@10.1.0.50 \
44   docker pull ${DOCKER_REPO}:$DOCKER_TAG >$redirect
45
46 if [ ! -n "$BRANCH" ]; then
47   BRANCH=master
48 fi
49
50 opts="--name=yardstick --privileged=true --net=host -d -it "
51 envs="-e YARDSTICK_BRANCH=${BRANCH} -e BRANCH=${BRANCH} \
52   -e NODE_NAME=${NODE_NAME} \
53   -e DEPLOY_SCENARIO=${DEPLOY_SCENARIO}"
54 rc_file_vol="-v /etc/yardstick/admin.conf:/etc/yardstick/admin.conf"
55 cacert_file_vol=""
56 map_log_dir=""
57 sshkey=""
58 YARDSTICK_SCENARIO_SUITE_NAME="opnfv_k8-nosdn-lb-noha_daily.yaml"
59
60 # map log directory
61 branch=${BRANCH##*/}
62 #branch="master"
63 dir_result="${HOME}/opnfv/yardstick/results/${branch}"
64 mkdir -p ${dir_result}
65 sudo rm -rf ${dir_result}/*
66 map_log_dir="-v ${dir_result}:/tmp/yardstick"
67
68 # Run docker
69 cmd="docker rm -f yardstick || true"
70 sshpass -p root ssh root@10.1.0.50 \
71   ${cmd}
72
73 cmd="sudo docker run ${opts} ${envs} ${rc_file_vol} ${cacert_file_vol} ${map_log_dir} ${sshkey} ${DOCKER_REPO}:${DOCKER_TAG} /bin/bash"
74 echo "Yardstick: Running docker cmd: ${cmd}"
75 sshpass -p root ssh root@10.1.0.50 \
76   ${cmd}
77
78
79 cmd='sudo docker exec yardstick sed -i.bak "/# execute tests/i\sed -i.bak \"s/openretriever\\\/yardstick/openretriever\\\/yardstick_aarch64/g\" \
80     $\{YARDSTICK_REPO_DIR\}/tests/opnfv/test_cases/opnfv_yardstick_tc080.yaml" /usr/local/bin/exec_tests.sh'
81 sshpass -p root ssh root@10.1.0.50 \
82   ${cmd}
83
84 echo "Yardstick: run tests: ${YARDSTICK_SCENARIO_SUITE_NAME}"
85 cmd="sudo docker exec yardstick exec_tests.sh ${YARDSTICK_DB_BACKEND} ${YARDSTICK_SCENARIO_SUITE_NAME}"
86 sshpass -p root ssh root@10.1.0.50 \
87   ${cmd}
88
89 cmd="docker rm -f yardstick"
90 sshpass -p root ssh root@10.1.0.50 \
91   ${cmd}
92
93 echo "Yardstick: done!"