2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2016 Ericsson AB and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
13 # do not continue with the deployment if FRESH_INSTALL is not requested
14 if [[ "$FRESH_INSTALL" == "true" ]]; then
15 echo "Fresh install requested. Proceeding with the installation."
17 echo "Fresh install is not requested. Skipping the installation."
22 export BRANCH=$(echo $BRANCH | sed 's/stable\///g')
23 # get the latest successful job console log and extract the properties filename
24 FUEL_DEPLOY_BUILD_URL="https://build.opnfv.org/ci/job/fuel-deploy-virtual-daily-$BRANCH/lastSuccessfulBuild/consoleText"
25 FUEL_PROPERTIES_FILE=$(curl -s -L ${FUEL_DEPLOY_BUILD_URL} | grep 'ISO:' | awk '{print $2}' | sed 's/iso/properties/g')
26 if [[ -z "FUEL_PROPERTIES_FILE" ]]; then
27 echo "Unable to extract the url to Fuel ISO properties from ${FUEL_DEPLOY_URL}"
31 # use known/working version of fuel
32 #FUEL_PROPERTIES_FILE="opnfv-2017-03-06_16-00-15.properties"
33 curl -L -s -o $WORKSPACE/latest.properties $GS_PATH/$FUEL_PROPERTIES_FILE
35 # source the file so we get OPNFV vars
36 source latest.properties
38 # echo the info about artifact that is used during the deployment
39 echo "Using ${OPNFV_ARTIFACT_URL/*\/} for deployment"
42 echo "Downloading the ISO using the link http://$OPNFV_ARTIFACT_URL"
43 curl -L -s -o $WORKSPACE/opnfv.iso http://$OPNFV_ARTIFACT_URL > gsutil.iso.log 2>&1
46 # set deployment parameters
47 DEPLOY_SCENARIO="os-nosdn-nofeature-noha"
48 export TMPDIR=$HOME/tmpdir
50 LAB_NAME=${NODE_NAME/-*}
51 POD_NAME=${NODE_NAME/*-}
53 if [[ "$NODE_NAME" =~ "virtual" ]]; then
54 POD_NAME="virtual_kvm"
57 # we currently support ericsson, intel, lf and zte labs
58 if [[ ! "$LAB_NAME" =~ (ericsson|intel|lf|zte) ]]; then
59 echo "Unsupported/unidentified lab $LAB_NAME. Cannot continue!"
62 echo "Using configuration for $LAB_NAME"
65 # create TMPDIR if it doesn't exist
66 export TMPDIR=$HOME/tmpdir
69 # change permissions down to TMPDIR
73 # clone fuel repo and checkout the sha1 that corresponds to the ISO
74 echo "Cloning fuel repo"
75 git clone https://gerrit.opnfv.org/gerrit/p/fuel.git fuel
77 echo "Checking out $OPNFV_GIT_SHA1"
78 git checkout $OPNFV_GIT_SHA1 --quiet
80 # clone the securedlab repo
82 echo "Cloning securedlab repo ${GIT_BRANCH##origin/}"
83 git clone ssh://jenkins-ericsson@gerrit.opnfv.org:29418/securedlab --quiet \
84 --branch ${GIT_BRANCH##origin/}
87 FUEL_LOG_FILENAME="${JOB_NAME}_${BUILD_NUMBER}.log.tar.gz"
89 # construct the command
90 DEPLOY_COMMAND="sudo $WORKSPACE/fuel/ci/deploy.sh -b file://$WORKSPACE/securedlab \
91 -l $LAB_NAME -p $POD_NAME -s $DEPLOY_SCENARIO -i file://$WORKSPACE/opnfv.iso \
92 -B $BRIDGE -S $TMPDIR -L $WORKSPACE/$FUEL_LOG_FILENAME"
95 echo "Deployment parameters"
96 echo "--------------------------------------------------------"
97 echo "Scenario: $DEPLOY_SCENARIO"
100 echo "ISO: ${OPNFV_ARTIFACT_URL/*\/}"
102 echo "Starting the deployment using $INSTALLER_TYPE. This could take some time..."
103 echo "--------------------------------------------------------"
106 # start the deployment
107 echo "Issuing command"
108 echo "$DEPLOY_COMMAND"
115 echo "--------------------------------------------------------"
116 echo "Deployment is done!"
118 if [[ $exit_code -ne 0 ]]; then
119 echo "Deployment failed!"
122 echo "Deployment is successful!"