501b661be4a1f140121926794c177cf5ceb2e6dc
[yardstick.git] / ci / docker / yardstick-ci / run_benchmarks
1 #!/bin/bash
2 ##############################################################################
3 # Copyright (c) 2015 Ericsson AB and others.
4 #
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10
11 set -e
12
13 : ${YARDSTICK_REPO:='https://gerrit.opnfv.org/gerrit/yardstick'}
14 : ${YARDSTICK_REPO_DIR:='/home/opnfv/yardstick'}
15 : ${YARDSTICK_BRANCH:='master'} # branch, tag, sha1 or refspec
16
17 : ${RELENG_REPO:='https://gerrit.opnfv.org/gerrit/releng'}
18 : ${RELENG_REPO_DIR:='/home/opnfv/repos/releng'}
19 : ${RELENG_BRANCH:='master'} # branch, tag, sha1 or refspec
20
21 : ${INSTALLER_TYPE:='fuel'}
22 : ${INSTALLER_IP:='10.20.0.2'}
23
24 : ${POD_NAME:='opnfv-jump-2'}
25 : ${EXTERNAL_NET:='net04_ext'}
26
27 git_checkout()
28 {
29     if git cat-file -e $1^{commit} 2>/dev/null; then
30         # branch, tag or sha1 object
31         git checkout $1
32     else
33         # refspec / changeset
34         git fetch --tags --progress $2 $1
35         git checkout FETCH_HEAD
36     fi
37 }
38
39 echo
40 echo "INFO: Updating releng -> $RELENG_BRANCH"
41 if [ ! -d $RELENG_REPO_DIR ]; then
42     git clone $RELENG_REPO $RELENG_REPO_DIR
43 fi
44 cd $RELENG_REPO_DIR
45 git checkout master && git pull
46 git_checkout $RELENG_BRANCH $RELENG_REPO
47
48 echo
49 echo "INFO: Updating yardstick -> $YARDSTICK_BRANCH"
50 if [ ! -d $YARDSTICK_REPO_DIR ]; then
51     git clone YARDSTICK_REPO $YARDSTICK_REPO_DIR
52 fi
53 cd $YARDSTICK_REPO_DIR
54 git checkout master && git pull
55 git_checkout $YARDSTICK_BRANCH $YARDSTICK_REPO
56
57 echo
58 echo "INFO: Creating openstack credentials .."
59
60 # Create openstack credentials
61 $RELENG_REPO_DIR/utils/fetch_os_creds.sh \
62     -d /tmp/openrc \
63     -i ${INSTALLER_TYPE} -a ${INSTALLER_IP}
64
65 source /tmp/openrc
66
67 # FIXME: Temporary OPNFV playground hack
68 if [ "$INSTALLER_TYPE" == "fuel" ]; then
69     ssh_opts="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
70     if sshpass -p r00tme ssh 2>/dev/null $ssh_opts root@${INSTALLER_IP} \
71         fuel environment --env 1 | grep opnfv-virt; then
72         echo "INFO: applying OPNFV playground hack"
73         export OS_ENDPOINT_TYPE='publicURL'
74     fi
75 fi
76
77 export EXTERNAL_NET INSTALLER_TYPE POD_NAME
78
79 $YARDSTICK_REPO_DIR/ci/yardstick-verify $@