fuel: Create job for os-odl_l2-sfc-ha scenario
[releng.git] / jjb / fuel / fuel-deploy.sh
1 #!/bin/bash
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 ##############################################################################
10 set -o errexit
11 set -o nounset
12 set -o pipefail
13
14 # source the file so we get OPNFV vars
15 source latest.properties
16
17 # echo the info about artifact that is used during the deployment
18 echo "Using ${OPNFV_ARTIFACT_URL/*\/} for deployment"
19
20 if [[ "$JOB_NAME" =~ "merge" ]]; then
21     # set simplest scenario for virtual deploys to run for merges
22     DEPLOY_SCENARIO="os-nosdn-nofeature-ha"
23 else
24     # for none-merge deployments
25     # checkout the commit that was used for building the downloaded artifact
26     # to make sure the ISO and deployment mechanism uses same versions
27     echo "Checking out $OPNFV_GIT_SHA1"
28     git checkout $OPNFV_GIT_SHA1 --quiet
29 fi
30
31 # set deployment parameters
32 export TMPDIR=$HOME/tmpdir
33 BRIDGE=pxebr
34 LAB_NAME=${NODE_NAME/-*}
35 POD_NAME=${NODE_NAME/*-}
36
37 if [[ "$NODE_NAME" == "opnfv-jump-2" ]]; then
38     LAB_NAME="lf"
39     POD_NAME="pod2"
40 fi
41
42 if [[ "$NODE_NAME" =~ "virtual" ]]; then
43     POD_NAME="virtual_kvm"
44 fi
45
46 # we currently support ericsson, intel, and lf labs
47 if [[ ! "$LAB_NAME" =~ (ericsson|intel|lf) ]]; then
48     echo "Unsupported/unidentified lab $LAB_NAME. Cannot continue!"
49     exit 1
50 else
51     echo "Using configuration for $LAB_NAME"
52 fi
53
54 # create TMPDIR if it doesn't exist
55 export TMPDIR=$HOME/tmpdir
56 mkdir -p $TMPDIR
57
58 # change permissions down to TMPDIR
59 chmod a+x $HOME
60 chmod a+x $TMPDIR
61
62 # clone the securedlab repo
63 cd $WORKSPACE
64 echo "Cloning securedlab repo ${GIT_BRANCH##origin/}"
65 git clone ssh://jenkins-ericsson@gerrit.opnfv.org:29418/securedlab --quiet --branch ${GIT_BRANCH##origin/}
66
67 # construct the command
68 DEPLOY_COMMAND="sudo $WORKSPACE/ci/deploy.sh -b file://$WORKSPACE/securedlab -l $LAB_NAME -p $POD_NAME -s $DEPLOY_SCENARIO -i file://$WORKSPACE/opnfv.iso -H -B $BRIDGE -S $TMPDIR"
69
70 # log info to console
71 echo "Deployment parameters"
72 echo "--------------------------------------------------------"
73 echo "Scenario: $DEPLOY_SCENARIO"
74 echo "Lab: $LAB_NAME"
75 echo "POD: $POD_NAME"
76 echo "ISO: ${OPNFV_ARTIFACT_URL/*\/}"
77 echo
78 echo "Starting the deployment using $INSTALLER_TYPE. This could take some time..."
79 echo "--------------------------------------------------------"
80 echo
81
82 # start the deployment
83 echo "Issuing command"
84 echo "$DEPLOY_COMMAND"
85 echo
86
87 $DEPLOY_COMMAND
88
89 echo
90 echo "--------------------------------------------------------"
91 echo "Deployment is done successfully!"
92
93 # Quick and dirty fix for SFC scenatio - will be fixed properly post-release
94 if [[ "$DEPLOY_SCENARIO" !~ "os-odl_l2-sfc" ]]; then
95     exit 0
96 fi
97
98 echo "SFC Scenario is deployed"
99
100 # TBD: This is where we need to transfer poc.tacker-up.ssh script to
101 # controller + ODL node