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."
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-master/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}"
30 curl -L -s -o $WORKSPACE/latest.properties http://artifacts.opnfv.org/fuel/$FUEL_PROPERTIES_FILE
32 # source the file so we get OPNFV vars
33 source latest.properties
35 # echo the info about artifact that is used during the deployment
36 echo "Using ${OPNFV_ARTIFACT_URL/*\/} for deployment"
39 echo "Downloading the ISO using the link http://$OPNFV_ARTIFACT_URL"
40 curl -L -s -o $WORKSPACE/opnfv.iso http://$OPNFV_ARTIFACT_URL > gsutil.iso.log 2>&1
43 # set deployment parameters
44 DEPLOY_SCENARIO="os-nosdn-nofeature-noha"
45 export TMPDIR=$HOME/tmpdir
46 BRIDGE=${BRIDGE:-pxebr}
47 LAB_NAME=${NODE_NAME/-*}
48 POD_NAME=${NODE_NAME/*-}
50 if [[ "$NODE_NAME" =~ "virtual" ]]; then
51 POD_NAME="virtual_kvm"
54 # we currently support ericsson, intel, lf and zte labs
55 if [[ ! "$LAB_NAME" =~ (ericsson|intel|lf|zte) ]]; then
56 echo "Unsupported/unidentified lab $LAB_NAME. Cannot continue!"
59 echo "Using configuration for $LAB_NAME"
62 # create TMPDIR if it doesn't exist
63 export TMPDIR=$HOME/tmpdir
66 # change permissions down to TMPDIR
70 # clone fuel repo and checkout the sha1 that corresponds to the ISO
71 echo "Cloning fuel repo"
72 git clone https://gerrit.opnfv.org/gerrit/p/fuel.git fuel
74 echo "Checking out $OPNFV_GIT_SHA1"
75 git checkout $OPNFV_GIT_SHA1 --quiet
77 # clone the securedlab repo
79 echo "Cloning securedlab repo ${GIT_BRANCH##origin/}"
80 git clone ssh://jenkins-ericsson@gerrit.opnfv.org:29418/securedlab --quiet \
81 --branch ${GIT_BRANCH##origin/}
84 FUEL_LOG_FILENAME="${JOB_NAME}_${BUILD_NUMBER}.log.tar.gz"
86 # construct the command
87 DEPLOY_COMMAND="sudo $WORKSPACE/fuel/ci/deploy.sh -b file://$WORKSPACE/securedlab \
88 -l $LAB_NAME -p $POD_NAME -s $DEPLOY_SCENARIO -i file://$WORKSPACE/opnfv.iso \
89 -H -B $BRIDGE -S $TMPDIR -L $WORKSPACE/$FUEL_LOG_FILENAME"
92 echo "Deployment parameters"
93 echo "--------------------------------------------------------"
94 echo "Scenario: $DEPLOY_SCENARIO"
97 echo "ISO: ${OPNFV_ARTIFACT_URL/*\/}"
99 echo "Starting the deployment using $INSTALLER_TYPE. This could take some time..."
100 echo "--------------------------------------------------------"
103 # start the deployment
104 echo "Issuing command"
105 echo "$DEPLOY_COMMAND"
112 echo "--------------------------------------------------------"
113 echo "Deployment is done!"
115 if [[ $exit_code -ne 0 ]]; then
116 echo "Deployment failed!"
119 echo "Deployment is successful!"