blob: 842034eef6c90c270dbf701b97a440360fa21db2 [file] [log] [blame]
Gary Wu838c34d2017-10-23 14:22:40 -07001#!/bin/bash
2
3if [ -z "$OS_AUTH_URL" ] || [ -z "$OS_USERNAME" ]
4then
5 echo "ERROR: OpenStack environment variables not set. Please source your OpenStack RC script first."
6 exit 1
7fi
8
9
10if [ -z "$WORKSPACE" ]; then
11 export WORKSPACE=`git rev-parse --show-toplevel`
12fi
13
14
15
16# Assume that if ROBOT_VENV is set, we don't need to reinstall robot
17if [ -f ${WORKSPACE}/env.properties ]; then
18 source ${WORKSPACE}/env.properties
19fi
20
21if [ ! -z "$ONAP_VENV" ] && [ -f "$ONAP_VENV/bin/activate" ]; then
22 source ${ONAP_VENV}/bin/activate
23else
24 ONAP_VENV=$(mktemp -d --suffix=_onap_venv)
25 virtualenv ${ONAP_VENV}
26 source ${ONAP_VENV}/bin/activate
Gary Wu36e42dd2018-05-03 07:29:53 -070027
Gary Wu838c34d2017-10-23 14:22:40 -070028 pip install --upgrade pip
Gary Wu36e42dd2018-05-03 07:29:53 -070029 pip install python-openstackclient python-heatclient python-designateclient
30
Gary Wu838c34d2017-10-23 14:22:40 -070031 echo "ONAP_VENV=${ONAP_VENV}" >> $WORKSPACE/env.properties
32fi
33echo "ONAP_VENV=${ONAP_VENV}"
34
35if [ -z "$ONAP_WORKDIR" ]; then
36 ONAP_WORKDIR=$(mktemp -d --suffix=_onap_workdir)
37 echo "ONAP_WORKDIR=${ONAP_WORKDIR}" >> $WORKSPACE/env.properties
38fi
39echo "ONAP_WORKDIR=${ONAP_WORKDIR}"
40if [ ! -d ${ONAP_WORKDIR}/demo ]; then
Gary Wuf5fef8b2017-11-09 10:59:46 -080041 git clone https://gerrit.onap.org/r/demo ${ONAP_WORKDIR}/demo
Gary Wu838c34d2017-10-23 14:22:40 -070042else
43 pushd ${ONAP_WORKDIR}/demo
44 git pull
45 popd
46fi
47