2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2016 Ericsson AB and others.
5 # (c) 2017 Enea Software AB
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
16 if [[ "$BRANCH" != 'master' ]]; then
17 # source the file so we get OPNFV vars
18 source latest.properties
20 # echo the info about artifact that is used during the deployment
21 echo "Using ${OPNFV_ARTIFACT_URL/*\/} for deployment"
24 if [[ "$JOB_NAME" =~ "merge" ]]; then
25 # set simplest scenario for virtual deploys to run for merges
26 DEPLOY_SCENARIO="os-nosdn-nofeature-ha"
27 elif [[ "$BRANCH" != 'master' ]]; then
28 # for none-merge deployments
29 # checkout the commit that was used for building the downloaded artifact
30 # to make sure the ISO and deployment mechanism uses same versions
31 echo "Checking out $OPNFV_GIT_SHA1"
32 git checkout $OPNFV_GIT_SHA1 --quiet
35 # set deployment parameters
36 export TMPDIR=${WORKSPACE}/tmpdir
38 LAB_NAME=${NODE_NAME/-*}
39 POD_NAME=${NODE_NAME/*-}
41 # we currently support enea
42 if [[ ! $LAB_NAME =~ (arm|enea) ]]; then
43 echo "Unsupported/unidentified lab $LAB_NAME. Cannot continue!"
47 echo "Using configuration for $LAB_NAME"
49 # create TMPDIR if it doesn't exist
53 if [[ $LAB_CONFIG_URL =~ ^(git|ssh):// ]]; then
54 echo "Cloning securedlab repo $BRANCH"
55 git clone --quiet --branch $BRANCH $LAB_CONFIG_URL lab-config
56 LAB_CONFIG_URL=file://${WORKSPACE}/lab-config
58 # Source local_env if present, which contains POD-specific config
59 local_env="${WORKSPACE}/lab-config/labs/$LAB_NAME/$POD_NAME/fuel/config/local_env"
60 if [ -e $local_env ]; then
61 echo "-- Sourcing local environment file"
66 # releng wants us to use nothing else but opnfv.iso for now. We comply.
67 ISO_FILE=$WORKSPACE/opnfv.iso
70 FUEL_LOG_FILENAME="${JOB_NAME}_${BUILD_NUMBER}.log.tar.gz"
72 # Deploy Cache (to enable just create the deploy-cache subdir)
73 # NOTE: Only available when ISO files are cached using ISOSTORE mechanism
74 DEPLOY_CACHE=${ISOSTORE:-/iso_mount/opnfv_ci}/${BRANCH##*/}/deploy-cache
75 if [[ -d "${DEPLOY_CACHE}" ]]; then
76 echo "Deploy cache dir present."
77 echo "--------------------------------------------------------"
78 echo "Fuel@OPNFV deploy cache: ${DEPLOY_CACHE}"
79 DEPLOY_CACHE="-C ${DEPLOY_CACHE}"
84 # construct the command
85 DEPLOY_COMMAND="$WORKSPACE/ci/deploy.sh -b ${LAB_CONFIG_URL} \
86 -l $LAB_NAME -p $POD_NAME -s $DEPLOY_SCENARIO -i file://${ISO_FILE} \
87 -B ${DEFAULT_BRIDGE:-pxebr} -S $TMPDIR -L $WORKSPACE/$FUEL_LOG_FILENAME \
91 echo "Deployment parameters"
92 echo "--------------------------------------------------------"
93 echo "Scenario: $DEPLOY_SCENARIO"
96 [[ "$BRANCH" != 'master' ]] && echo "ISO: ${OPNFV_ARTIFACT_URL/*\/}"
98 echo "Starting the deployment using $INSTALLER_TYPE. This could take some time..."
99 echo "--------------------------------------------------------"
102 # start the deployment
103 echo "Issuing command"
104 echo "$DEPLOY_COMMAND"
111 echo "--------------------------------------------------------"
112 echo "Deployment is done!"
114 # upload logs for baremetal deployments
115 # work with virtual deployments is still going on so we skip that for the timebeing
116 if [[ "$JOB_NAME" =~ "baremetal-daily" ]]; then
117 echo "Uploading deployment logs"
118 gsutil cp $WORKSPACE/$FUEL_LOG_FILENAME gs://$GS_URL/logs/$FUEL_LOG_FILENAME > /dev/null 2>&1
119 echo "Logs are available as http://$GS_URL/logs/$FUEL_LOG_FILENAME"
122 if [[ $exit_code -ne 0 ]]; then
123 echo "Deployment failed!"
126 echo "Deployment is successful!"