fuel-deploy.sh: Add missing quotes in 'sudo -E'
[releng.git] / jjb / fuel / fuel-deploy.sh
index 7aa0b13..6525c7c 100755 (executable)
@@ -12,7 +12,7 @@ set -o pipefail
 
 export TERM="vt220"
 
-if [[ "$BRANCH" != 'master' ]]; then
+if [[ "$BRANCH" =~ 'danube' ]]; then
     # source the file so we get OPNFV vars
     source latest.properties
 
@@ -21,11 +21,11 @@ if [[ "$BRANCH" != 'master' ]]; then
 fi
 
 # shellcheck disable=SC2153
-if [[ "${JOB_NAME}" =~ "merge" ]]; then
-    # set simplest scenario for virtual deploys to run for merges
+if [[ "${JOB_NAME}" =~ 'verify' ]]; then
+    # set simplest scenario for virtual deploys to run for verify
     DEPLOY_SCENARIO="os-nosdn-nofeature-ha"
-elif [[ "${BRANCH}" != 'master' ]]; then
-    # for none-merge deployments
+elif [[ "${BRANCH}" =~ 'danube' ]]; then
+    # for Danube deployments (no artifact for current master or newer branches)
     # checkout the commit that was used for building the downloaded artifact
     # to make sure the ISO and deployment mechanism uses same versions
     echo "Checking out ${OPNFV_GIT_SHA1}"
@@ -39,17 +39,28 @@ BRIDGE=${BRIDGE:-pxebr}
 LAB_NAME=${NODE_NAME/-*}
 # shellcheck disable=SC2153
 POD_NAME=${NODE_NAME/*-}
-# Fuel requires deploy script to be ran with sudo
-SUDO=sudo
-
-if [[ "${NODE_NAME}" =~ "virtual" ]]; then
-    POD_NAME="virtual_kvm"
-fi
-
-# we currently support ericsson, intel, lf and zte labs
-if [[ ! "${LAB_NAME}" =~ (ericsson|intel|lf|zte) ]]; then
-    echo "Unsupported/unidentified lab ${LAB_NAME}. Cannot continue!"
-    exit 1
+# Armband might override LAB_CONFIG_URL, all others use the default
+LAB_CONFIG_URL=${LAB_CONFIG_URL:-'ssh://jenkins-ericsson@gerrit.opnfv.org:29418/securedlab'}
+
+# Fuel requires deploy script to be ran with sudo, Armband does not
+SUDO='sudo -E'
+if [ "${PROJECT}" = 'fuel' ]; then
+    # Fuel does not use any POD-specific configuration for virtual deploys
+    if [[ "${NODE_NAME}" =~ "virtual" ]]; then
+        POD_NAME="virtual_kvm"
+    fi
+    # Fuel currently supports ericsson, intel, lf and zte labs
+    if [[ ! "${LAB_NAME}" =~ (ericsson|intel|lf|zte) ]]; then
+        echo "Unsupported/unidentified lab ${LAB_NAME}. Cannot continue!"
+        exit 1
+    fi
+else
+    SUDO=
+    # Armband currently supports arm, enea labs
+    if [[ ! "${LAB_NAME}" =~ (arm|enea) ]]; then
+        echo "Unsupported/unidentified lab ${LAB_NAME}. Cannot continue!"
+        exit 1
+    fi
 fi
 
 echo "Using configuration for ${LAB_NAME}"
@@ -58,9 +69,6 @@ echo "Using configuration for ${LAB_NAME}"
 mkdir -p "${TMPDIR}"
 chmod a+x "${HOME}" "${TMPDIR}"
 
-# TODO: move lab-config URL to Jenkins param
-LAB_CONFIG_URL='ssh://jenkins-ericsson@gerrit.opnfv.org:29418/securedlab'
-
 cd "${WORKSPACE}" || exit 1
 if [[ "${LAB_CONFIG_URL}" =~ ^(git|ssh):// ]]; then
     echo "Cloning securedlab repo ${BRANCH}"