2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2018 Ericsson AB, Mirantis Inc., 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 ##############################################################################
15 # set deployment parameters
16 export TMPDIR=${HOME}/tmpdir
17 # shellcheck disable=SC2153
18 LAB_NAME=${NODE_NAME/-*}
19 # shellcheck disable=SC2153
20 POD_NAME=${NODE_NAME/*-}
22 # Fuel currently supports arm, enea, ericsson, intel, lf, unh and zte labs
23 if [[ ! "${LAB_NAME}" =~ (arm|enea|ericsson|intel|lf|unh|zte) ]]; then
24 echo "Unsupported/unidentified lab ${LAB_NAME}. Cannot continue!"
28 echo "Using configuration for ${LAB_NAME}"
30 # Certain labs do not require the deploy script to be ran with sudo
32 [[ ! "${LAB_NAME}" =~ (arm|enea|unh) ]] || SUDO=
34 # create TMPDIR if it doesn't exist, change permissions
36 sudo chmod a+x "${HOME}" "${TMPDIR}"
38 cd "${WORKSPACE}" || exit 1
41 FUEL_LOG_FILENAME="${JOB_NAME}_${BUILD_NUMBER}.log.tar.gz"
43 # Limited scope for vPOD verify jobs running on armband-virtual
44 [[ ! "${JOB_NAME}" =~ verify-deploy-virtual-arm64 ]] || EXTRA_ARGS='-e'
46 # construct the command
47 DEPLOY_COMMAND="${SUDO} ${WORKSPACE}/ci/deploy.sh \
48 -l ${LAB_NAME} -p ${POD_NAME} -s ${DEPLOY_SCENARIO} \
49 -S ${TMPDIR} ${EXTRA_ARGS:-} \
50 -L ${WORKSPACE}/${FUEL_LOG_FILENAME}"
53 echo "Deployment parameters"
54 echo "--------------------------------------------------------"
55 echo "Scenario: ${DEPLOY_SCENARIO}"
56 echo "Lab: ${LAB_NAME}"
57 echo "POD: ${POD_NAME}"
59 echo "Starting the deployment using ${INSTALLER_TYPE}. This could take some time..."
60 echo "--------------------------------------------------------"
63 # start the deployment
64 echo "Issuing command"
65 echo "${DEPLOY_COMMAND}"
72 echo "--------------------------------------------------------"
73 echo "Deployment is done!"
75 # upload logs for baremetal deployments
76 # work with virtual deployments is still going on, so skip that for now
77 if [[ "${JOB_NAME}" =~ baremetal-daily ]]; then
78 echo "Uploading deployment logs"
79 gsutil cp "${WORKSPACE}/${FUEL_LOG_FILENAME}" \
80 "gs://${GS_URL}/logs/${FUEL_LOG_FILENAME}" > /dev/null 2>&1
81 echo "Logs are available at http://${GS_URL}/logs/${FUEL_LOG_FILENAME}"
84 if [[ "${exit_code}" -ne 0 ]]; then
85 echo "Deployment failed!"
89 echo "Deployment is successful!"