blob: 408aae6974d110df54dbd5e2b728a82bfdbb60a9 [file] [log] [blame]
Gary Wu838c34d2017-10-23 14:22:40 -07001#!/bin/bash
2
Gary Wu6d46bb52018-07-19 12:36:08 -07003if ! hash openstack jq
4then
5 echo "ERROR: Required commands not found; please install openstack CLI and jq."
6 exit 2
7fi
8
Gary Wu838c34d2017-10-23 14:22:40 -07009if [ -z "$OS_AUTH_URL" ] || [ -z "$OS_USERNAME" ]
10then
11 echo "ERROR: OpenStack environment variables not set. Please source your OpenStack RC script first."
12 exit 1
13fi
14
Gary Wu838c34d2017-10-23 14:22:40 -070015if [ -z "$WORKSPACE" ]; then
16 export WORKSPACE=`git rev-parse --show-toplevel`
17fi
18
Gary Wu838c34d2017-10-23 14:22:40 -070019if [ -f ${WORKSPACE}/env.properties ]; then
20 source ${WORKSPACE}/env.properties
21fi
22
Gary Wu838c34d2017-10-23 14:22:40 -070023if [ -z "$ONAP_WORKDIR" ]; then
24 ONAP_WORKDIR=$(mktemp -d --suffix=_onap_workdir)
25 echo "ONAP_WORKDIR=${ONAP_WORKDIR}" >> $WORKSPACE/env.properties
26fi
27echo "ONAP_WORKDIR=${ONAP_WORKDIR}"
28if [ ! -d ${ONAP_WORKDIR}/demo ]; then
Gary Wuc076ada2018-06-07 16:38:25 -070029 git clone https://gerrit.onap.org/r/demo ${ONAP_WORKDIR}/demo
Gary Wu838c34d2017-10-23 14:22:40 -070030else
31 pushd ${ONAP_WORKDIR}/demo
Gary Wu838c34d2017-10-23 14:22:40 -070032 git pull
33 popd
34fi