iec: view: Stop filtering out the sonar job
[ci-management.git] / jjb / iec / iec-fuel-deploy.sh
1 #!/bin/bash
2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2019 Enea Software 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 nounset
11
12 export TERM="vt220"
13
14 # set deployment parameters
15 export TMPDIR=${HOME}/tmpdir
16 if [ "$(uname -m)" = 'aarch64' ]; then
17     LAB_NAME='arm'
18     # shellcheck disable=SC2153
19     POD_NAME=${NODE_NAME/*ubuntu1804-dev-48c-256g-/virtual}
20     if [[ ! "$POD_NAME" =~ virtual ]]; then
21         POD_NAME=${NODE_NAME/*ubuntu1804-dev-96c-256g-/baremetal}
22     fi
23 fi
24 if [[ ! "$POD_NAME" =~ (virtual|baremetal) ]]; then
25     echo "Unavailable hardware. Cannot continue!"
26     exit 1
27 fi
28
29 echo "Using configuration for ${LAB_NAME}"
30
31 # create TMPDIR if it doesn't exist, change permissions
32 mkdir -p "${TMPDIR}"
33 sudo chmod a+x "${HOME}" "${TMPDIR}"
34
35 cd "${WORKSPACE}" || exit 1
36
37 # log file name
38 # shellcheck disable=SC2153
39 FUEL_LOG_FILENAME="${JOB_NAME}_${BUILD_NUMBER}.log.tar.gz"
40
41 # turn on DEBUG mode
42 [ "${CI_DEBUG,,}" == 'true' ] && EXTRA_ARGS="-D ${EXTRA_ARGS:-}"
43
44 # construct the command
45 git clone https://github.com/opnfv/fuel.git
46
47 DEPLOY_COMMAND="fuel/ci/deploy.sh \
48     -l ${LAB_NAME} -p ${POD_NAME} -s ${DEPLOY_SCENARIO} \
49     -S ${TMPDIR} ${EXTRA_ARGS:-} \
50     -b file://${WORKSPACE}/ci
51     -L ${WORKSPACE}/${FUEL_LOG_FILENAME}"
52
53 # log info to console
54 echo "Deployment parameters"
55 echo "--------------------------------------------------------"
56 echo "Scenario: ${DEPLOY_SCENARIO}"
57 echo "Lab: ${LAB_NAME}"
58 echo "POD: ${POD_NAME}"
59 echo
60 echo "Starting the deployment using Fuel. This could take some time..."
61 echo "--------------------------------------------------------"
62 echo
63
64 # start the deployment
65 echo "Issuing command"
66 echo "${DEPLOY_COMMAND}"
67
68 ${DEPLOY_COMMAND}
69 exit_code=$?
70
71 echo
72 echo "--------------------------------------------------------"
73 echo "Deployment is done!"
74
75 if [ "${exit_code}" -ne 0 ]; then
76     echo "Deployment failed!"
77     exit "${exit_code}"
78 fi
79
80 echo "Deployment is successful!"
81 exit 0