Merge "Adding a new verification job for testapi UI."
[releng.git] / jjb / cperf / cperf-prepare-robot.sh
1 #!/usr/bin/env bash
2
3 set -o errexit
4 set -o nounset
5 set -o pipefail
6
7 if [ -z ${RC_FILE_PATH+x} ]; then
8   undercloud_mac=$(sudo virsh domiflist undercloud | grep default | \
9                    grep -Eo "[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+")
10   INSTALLER_IP=$(/usr/sbin/arp -e | grep ${undercloud_mac} | awk {'print $1'})
11   sudo scp -o StrictHostKeyChecking=no root@$INSTALLER_IP:/home/stack/overcloudrc /tmp/overcloudrc
12 else
13   cp -f $RC_FILE_PATH ${WORKSPACE}/overcloudrc
14 fi
15
16 sudo chmod 755 ${WORKSPACE}/overcloudrc
17 source ${WORKSPACE}/overcloudrc
18
19 # copy ssh key for robot
20
21 if [ -z ${SSH_KEY_PATH+x} ]; then
22   sudo scp -o StrictHostKeyChecking=no root@$INSTALLER_IP:/home/stack/.ssh/id_rsa ${WORKSPACE}/
23   sudo chown -R jenkins-ci:jenkins-ci ${WORKSPACE}/
24   # done with sudo. jenkins-ci is the user from this point
25   chmod 0600 ${WORKSPACE}/id_rsa
26 else
27   cp -f ${SSH_KEY_PATH} ${WORKSPACE}/
28 fi
29
30 docker pull opnfv/cperf:$DOCKER_TAG
31
32 sudo mkdir -p /tmp/robot_results