3ad6b7c7ca75881388e9caba1e28a165726a00c3
[releng.git] / jjb / yardstick / yardstick-daily.sh
1 #!/bin/bash
2 set -e
3 [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
4
5 # labconfig is used only for joid
6 labconfig=""
7 sshkey=""
8 if [[ ${INSTALLER_TYPE} == 'apex' ]]; then
9     instack_mac=$(sudo virsh domiflist instack | grep default | \
10                   grep -Eo "[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+")
11     INSTALLER_IP=$(/usr/sbin/arp -e | grep ${instack_mac} | awk {'print $1'})
12     sshkey="-v /root/.ssh/id_rsa:/root/.ssh/id_rsa"
13     if [[ -n $(sudo iptables -L FORWARD |grep "REJECT"|grep "reject-with icmp-port-unreachable") ]]; then
14         #note: this happens only in opnfv-lf-pod1
15         sudo iptables -D FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable
16         sudo iptables -D FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable
17     fi
18 elif [[ ${INSTALLER_TYPE} == 'joid' ]]; then
19     # If production lab then creds may be retrieved dynamically
20     # creds are on the jumphost, always in the same folder
21     labconfig="-v $LAB_CONFIG/admin-openrc:/home/opnfv/openrc"
22     # If dev lab, credentials may not be the default ones, just provide a path to put them into docker
23     # replace the default one by the customized one provided by jenkins config
24 fi
25
26 opts="--privileged=true --rm"
27 envs="-e INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} \
28     -e NODE_NAME=${NODE_NAME} -e EXTERNAL_NETWORK=${EXTERNAL_NETWORK} \
29     -e YARDSTICK_BRANCH=${GIT_BRANCH##origin/} -e DEPLOY_SCENARIO=${DEPLOY_SCENARIO}"
30
31 # Pull the latest image
32 docker pull opnfv/yardstick:$DOCKER_TAG >$redirect
33
34 # Run docker
35 cmd="sudo docker run ${opts} ${envs} ${labconfig} ${sshkey} opnfv/yardstick \
36     run_tests.sh ${YARDSTICK_DB_BACKEND} ${YARDSTICK_SUITE_NAME}"
37 echo "Yardstick: Running docker cmd: ${cmd}"
38 ${cmd}
39
40 echo "Yardstick: done!"