Merge "Increase node size to fix out of memory errors"
[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/*ubuntu1604-dev-48c-256g-/virtual}
20 else
21     echo "Unavailable hardware. Cannot continue!"
22     exit 1
23 fi
24
25 echo "Using configuration for ${LAB_NAME}"
26
27 # create TMPDIR if it doesn't exist, change permissions
28 mkdir -p "${TMPDIR}"
29 sudo chmod a+x "${HOME}" "${TMPDIR}"
30
31 cd "${WORKSPACE}" || exit 1
32
33 # log file name
34 # shellcheck disable=SC2153
35 FUEL_LOG_FILENAME="${JOB_NAME}_${BUILD_NUMBER}.log.tar.gz"
36
37 # turn on DEBUG mode
38 [ "${CI_DEBUG,,}" == 'true' ] && EXTRA_ARGS="-D ${EXTRA_ARGS:-}"
39
40 # construct the command
41 git clone https://github.com/opnfv/fuel.git
42
43 DEPLOY_COMMAND="fuel/ci/deploy.sh \
44     -l ${LAB_NAME} -p ${POD_NAME} -s ${DEPLOY_SCENARIO} \
45     -S ${TMPDIR} ${EXTRA_ARGS:-} \
46     -b file://${WORKSPACE}/ci
47     -L ${WORKSPACE}/${FUEL_LOG_FILENAME}"
48
49 # log info to console
50 echo "Deployment parameters"
51 echo "--------------------------------------------------------"
52 echo "Scenario: ${DEPLOY_SCENARIO}"
53 echo "Lab: ${LAB_NAME}"
54 echo "POD: ${POD_NAME}"
55 echo
56 echo "Starting the deployment using Fuel. This could take some time..."
57 echo "--------------------------------------------------------"
58 echo
59
60 # start the deployment
61 echo "Issuing command"
62 echo "${DEPLOY_COMMAND}"
63
64 ${DEPLOY_COMMAND}
65 exit_code=$?
66
67 echo
68 echo "--------------------------------------------------------"
69 echo "Deployment is done!"
70
71 if [ "${exit_code}" -ne 0 ]; then
72     echo "Deployment failed!"
73     exit "${exit_code}"
74 fi
75
76 echo "Deployment is successful!"
77 exit 0