Gary Wu | 838c34d | 2017-10-23 14:22:40 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Gary Wu | 6d46bb5 | 2018-07-19 12:36:08 -0700 | [diff] [blame] | 3 | if ! hash openstack jq |
| 4 | then |
| 5 | echo "ERROR: Required commands not found; please install openstack CLI and jq." |
| 6 | exit 2 |
| 7 | fi |
| 8 | |
Gary Wu | 838c34d | 2017-10-23 14:22:40 -0700 | [diff] [blame] | 9 | if [ -z "$OS_AUTH_URL" ] || [ -z "$OS_USERNAME" ] |
| 10 | then |
| 11 | echo "ERROR: OpenStack environment variables not set. Please source your OpenStack RC script first." |
| 12 | exit 1 |
| 13 | fi |
| 14 | |
Gary Wu | 838c34d | 2017-10-23 14:22:40 -0700 | [diff] [blame] | 15 | if [ -z "$WORKSPACE" ]; then |
| 16 | export WORKSPACE=`git rev-parse --show-toplevel` |
| 17 | fi |
| 18 | |
Gary Wu | 838c34d | 2017-10-23 14:22:40 -0700 | [diff] [blame] | 19 | if [ -f ${WORKSPACE}/env.properties ]; then |
| 20 | source ${WORKSPACE}/env.properties |
| 21 | fi |
| 22 | |
Gary Wu | 838c34d | 2017-10-23 14:22:40 -0700 | [diff] [blame] | 23 | if [ -z "$ONAP_WORKDIR" ]; then |
| 24 | ONAP_WORKDIR=$(mktemp -d --suffix=_onap_workdir) |
| 25 | echo "ONAP_WORKDIR=${ONAP_WORKDIR}" >> $WORKSPACE/env.properties |
| 26 | fi |
| 27 | echo "ONAP_WORKDIR=${ONAP_WORKDIR}" |
| 28 | if [ ! -d ${ONAP_WORKDIR}/demo ]; then |
Gary Wu | c076ada | 2018-06-07 16:38:25 -0700 | [diff] [blame] | 29 | git clone https://gerrit.onap.org/r/demo ${ONAP_WORKDIR}/demo |
Gary Wu | 838c34d | 2017-10-23 14:22:40 -0700 | [diff] [blame] | 30 | else |
| 31 | pushd ${ONAP_WORKDIR}/demo |
Gary Wu | 838c34d | 2017-10-23 14:22:40 -0700 | [diff] [blame] | 32 | git pull |
| 33 | popd |
| 34 | fi |