From f82334365c86fcee00310456f17b40d6af782f23 Mon Sep 17 00:00:00 2001 From: Gary Wu Date: Fri, 5 Jan 2018 13:16:26 -0800 Subject: Refactor CI script to support other envionments Change-Id: I4befdd9dc89a04620b53de8675f241f43d4e144e Issue-ID: INT-278 Signed-off-by: Gary Wu (cherry picked from commit 3c0b105517b51584edd114765560f11ebabb4a4e) --- test/ete/scripts/deploy-onap.sh | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'test/ete/scripts') diff --git a/test/ete/scripts/deploy-onap.sh b/test/ete/scripts/deploy-onap.sh index 9c9bfc110..c87f9a94e 100755 --- a/test/ete/scripts/deploy-onap.sh +++ b/test/ete/scripts/deploy-onap.sh @@ -1,9 +1,21 @@ #!/bin/bash -x +if [ "$#" -ne 1 ]; then + echo "Usage: $0 " + exit 1 +fi + if [ -z "$WORKSPACE" ]; then export WORKSPACE=`git rev-parse --show-toplevel` fi +LAB_DIR=${WORKSPACE}/test/ete/labs/$1 + +if [ ! -d "$LAB_DIR" ]; then + echo "Directory $LAB_DIR not found" + exit 2 +fi + source $WORKSPACE/test/ete/scripts/install_openstack_cli.sh $WORKSPACE/test/ete/scripts/teardown-onap.sh @@ -14,9 +26,9 @@ echo "New Stack Name: ${STACK}" SENTINEL='Docker versions and branches' YAML_FILE=${ONAP_WORKDIR}/demo/heat/ONAP/onap_openstack.yaml -ENV_FILE=${WORKSPACE}/test/ete/labs/windriver/onap-openstack.env -cp ${ONAP_WORKDIR}/demo/heat/ONAP/onap_openstack.env ${WORKSPACE}/test/ete/labs/windriver/onap-openstack-demo.env -envsubst < ${WORKSPACE}/test/ete/labs/windriver/onap-openstack-template.env | sed -n "1,/${SENTINEL}/p" > ${ENV_FILE} +ENV_FILE=${LAB_DIR}/onap-openstack.env +cp ${ONAP_WORKDIR}/demo/heat/ONAP/onap_openstack.env ${LAB_DIR}/onap-openstack-demo.env +envsubst < ${LAB_DIR}/onap-openstack-template.env | sed -n "1,/${SENTINEL}/p" > ${ENV_FILE} pushd ${ONAP_WORKDIR}/demo echo " # Rest of the file was AUTO-GENERATED from" echo " #" $(git config --get remote.origin.url) heat/ONAP/onap_openstack.env $(git rev-parse HEAD) | tee -a ${ENV_FILE} @@ -24,9 +36,9 @@ popd sed "1,/${SENTINEL}/d" ${ONAP_WORKDIR}/demo/heat/ONAP/onap_openstack.env >> ${ENV_FILE} cat ${ENV_FILE} -#diff ${WORKSPACE}/test/ete/labs/windriver/onap-openstack-template.env ${WORKSPACE}/test/ete/labs/windriver/onap-openstack.env +#diff ${LAB_DIR}/onap-openstack-template.env ${LAB_DIR}/onap-openstack.env -openstack stack create -t ${YAML_FILE} -e ${WORKSPACE}/test/ete/labs/windriver/onap-openstack.env $STACK +openstack stack create -t ${YAML_FILE} -e ${LAB_DIR}/onap-openstack.env $STACK while [ "CREATE_IN_PROGRESS" == "$(openstack stack show -c stack_status -f value $STACK)" ]; do sleep 20 -- cgit 1.2.3-korg