098cfe99dc1ae02124846f01f95782f2dcab2f9a
[releng.git] / jjb / compass4nfv / compass-deploy.sh
1 #!/bin/bash
2 set -x
3
4 # log info to console
5 echo "Starting the deployment on baremetal environment using $INSTALLER_TYPE. This could take some time..."
6 echo "--------------------------------------------------------"
7 echo
8
9 # source the properties file so we get OPNFV vars
10 source $BUILD_DIRECTORY/latest.properties
11
12 # echo the info about artifact that is used during the deployment
13 echo "Using ${OPNFV_ARTIFACT_URL/*\/} for deployment"
14
15 if [[ ! "$JOB_NAME" =~ (verify|merge) ]]; then
16     # for none-merge deployments
17     # checkout the commit that was used for building the downloaded artifact
18     # to make sure the ISO and deployment mechanism uses same versions
19     echo "Checking out $OPNFV_GIT_SHA1"
20     git checkout $OPNFV_GIT_SHA1 --quiet
21 fi
22
23 echo 1 > /proc/sys/vm/drop_caches
24
25 export CONFDIR=$WORKSPACE/deploy/conf
26 export ISO_URL=file://$BUILD_DIRECTORY/compass.iso
27
28 if [[ "${DEPLOY_SCENARIO}" =~ "-ocl" ]]
29     export NETWORK_CONF_FILE=network_ocl.yml
30 else
31     export NETWORK_CONF_FILE=network.yml
32 fi
33
34 if [[ "$NODE_NAME" =~ "-virtual" ]]; then
35     export NETWORK_CONF=$CONFDIR/vm_environment/$NODE_NAME/${NETWORK_CONF_FILE}
36     export DHA_CONF=$CONFDIR/vm_environment/${DEPLOY_SCENARIO}.yml
37 else
38     export INSTALL_NIC=eth1
39     export NETWORK_CONF=$CONFDIR/hardware_environment/$NODE_NAME/${NETWORK_CONF_FILE}
40     export DHA_CONF=$CONFDIR/hardware_environment/$NODE_NAME/${DEPLOY_SCENARIO}.yml
41 fi
42
43 cd $WORKSPACE
44
45 export OS_VERSION=${COMPASS_OS_VERSION}
46 export OPENSTACK_VERSION=${COMPASS_OPENSTACK_VERSION}
47 ./deploy.sh --dha ${DHA_CONF} --network ${NETWORK_CONF}
48 if [ $? -ne 0 ]; then
49     echo "depolyment failed!"
50     deploy_ret=1
51 fi
52
53 echo
54 echo "--------------------------------------------------------"
55 echo "Done!"
56
57 ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
58 sshpass -p root scp 2>/dev/null $ssh_options root@${INSTALLER_IP}:/var/ansible/run/openstack_${COMPASS_OPENSTACK_VERSION}-opnfv2/ansible.log ./  &> /dev/null
59
60 exit $deploy_ret