summaryrefslogtreecommitdiffstats
path: root/jjb/cperf/cperf-prepare-robot.sh
blob: d88c6d5101aa369a5516595ee83137af2b33291b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env bash

set -o errexit
set -o nounset
set -o pipefail

if [ -z ${RC_FILE_PATH+x} ]; then
  undercloud_mac=$(sudo virsh domiflist undercloud | grep default | \
                   grep -Eo "[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+")
  INSTALLER_IP=$(/usr/sbin/arp -e | grep ${undercloud_mac} | awk {'print $1'})
  sudo scp -o StrictHostKeyChecking=no root@$INSTALLER_IP:/home/stack/overcloudrc /tmp/overcloudrc
else
  cp -f $RC_FILE_PATH ${WORKSPACE}/overcloudrc
fi

sudo chmod 755 ${WORKSPACE}/overcloudrc
source ${WORKSPACE}/overcloudrc

# copy ssh key for robot

if [ -z ${SSH_KEY_PATH+x} ]; then
  sudo scp -o StrictHostKeyChecking=no root@$INSTALLER_IP:/home/stack/.ssh/id_rsa ${WORKSPACE}/
  sudo chown -R jenkins-ci:jenkins-ci ${WORKSPACE}/
  # done with sudo. jenkins-ci is the user from this point
  chmod 0600 ${WORKSPACE}/id_rsa
else
  cp -f ${SSH_KEY_PATH} ${WORKSPACE}/
fi

docker pull opnfv/cperf:$DOCKER_TAG

sudo mkdir -p /tmp/robot_results