summaryrefslogtreecommitdiffstats
path: root/jjb/apex/apex-deploy-baremetal.sh
diff options
context:
space:
mode:
authorFatih Degirmenci <fatih.degirmenci@ericsson.com>2016-05-26 00:39:18 +0200
committerFatih Degirmenci <fatih.degirmenci@ericsson.com>2016-05-26 00:39:18 +0200
commitb417f69a136a032a3a6f6075abecb7b10ed64167 (patch)
tree041bdd52826b44409c2d68d3088ea324a36fb9de /jjb/apex/apex-deploy-baremetal.sh
parentce4601a1ddc92b32afeef181644fdab09287d948 (diff)
apex: Take builders out of jjb
Having builders embedded in jjb makes maintenance harder than what it could be and error prone so the builders have been taken out. Apart from this, the upcoming change proposals will split yml files in 2, aligning with the rest and jobs in these files can reuse same builders when they are converted in shell scripts. This is the first change in series, trying to align job structure with the rest in order to ease the effort required to troubleshoot the deployments during release verification. The changes are - take builders out of jjb (this patch) - align the main CI jobs with the rest; 1 parent job per scenario/branch which controls triggering and execution of 3 downstream jobs; deploy, yardstick, functest - split yml file in 2; ci jobs ending in apex-ci-jobs.yml (daily) and project jobs ending in apex-project-jobs.yml. (verify, merge, build) Change-Id: I01f8bf351f0cbafbee1f41ec24ad5c2c6f21316f Signed-off-by: Fatih Degirmenci <fatih.degirmenci@ericsson.com>
Diffstat (limited to 'jjb/apex/apex-deploy-baremetal.sh')
-rwxr-xr-xjjb/apex/apex-deploy-baremetal.sh84
1 files changed, 84 insertions, 0 deletions
diff --git a/jjb/apex/apex-deploy-baremetal.sh b/jjb/apex/apex-deploy-baremetal.sh
new file mode 100755
index 000000000..efb6561d7
--- /dev/null
+++ b/jjb/apex/apex-deploy-baremetal.sh
@@ -0,0 +1,84 @@
+#!/bin/bash
+set -o errexit
+set -o nounset
+set -o pipefail
+
+# log info to console
+echo "Starting the Apex baremetal deployment."
+echo "--------------------------------------------------------"
+echo
+
+if [[ ! "$ARTIFACT_NAME" == "latest" ]]; then
+ # if artifact name is passed the pull a
+ # specific artifact from artifacts.opnfv.org
+ RPM_INSTALL_PATH=$GS_URL/$ARTIFACT_NAME
+else
+ if [[ $BUILD_DIRECTORY == *apex-build* ]]; then
+ BUILD_DIRECTORY=$WORKSPACE/../$BUILD_DIRECTORY
+ echo "BUILD DIRECTORY modified to $BUILD_DIRECTORY"
+ fi
+ if [[ -f ${BUILD_DIRECTORY}/../opnfv.properties ]]; then
+ # if opnfv.properties exists then use the
+ # local build. Source the file so we get local OPNFV vars
+ source ${BUILD_DIRECTORY}/../opnfv.properties
+ RPM_INSTALL_PATH=${BUILD_DIRECTORY}/$(basename $OPNFV_RPM_URL)
+ else
+ # no opnfv.properties means use the latest from artifacts.opnfv.org
+ # get the latest.properties to get the link to the latest artifact
+ curl -s -o $WORKSPACE/opnfv.properties http://$GS_URL/latest.properties
+ [[ -f opnfv.properties ]] || exit 1
+ # source the file so we get OPNFV vars
+ source opnfv.properties
+ RPM_INSTALL_PATH=$OPNFV_RPM_URL
+ fi
+fi
+
+if [ ! -e "$RPM_INSTALL_PATH" ]; then
+ RPM_INSTALL_PATH=http://${OPNFV_RPM_URL}
+fi
+
+RPM_LIST=$RPM_INSTALL_PATH
+for pkg in common undercloud; do
+ RPM_LIST+=" ${RPM_INSTALL_PATH/opnfv-apex/opnfv-apex-${pkg}}"
+done
+
+# update / install the new rpm
+if rpm -q opnfv-apex > /dev/null; then
+ if [ $(basename $OPNFV_RPM_URL) == $(rpm -q opnfv-apex).rpm ]; then
+ echo "RPM is already installed"
+ elif sudo yum update -y $RPM_LIST | grep "does not update installed package"; then
+ if ! sudo yum downgrade -y $RPM_LIST; then
+ sudo yum remove -y opnfv-undercloud opnfv-common
+ sudo yum downgrade -y $RPM_INSTALL_PATH
+ fi
+ fi
+else
+ sudo yum install -y $RPM_LIST;
+fi
+
+# cleanup environment before we start
+sudo opnfv-clean
+# initiate baremetal deployment
+if [ -e /etc/opnfv-apex/network_settings.yaml ]; then
+ if [ -n "$DEPLOY_SCENARIO" ]; then
+ echo "Deploy Scenario set to ${DEPLOY_SCENARIO}"
+ if [ -e /etc/opnfv-apex/${DEPLOY_SCENARIO}.yaml ]; then
+ sudo opnfv-deploy -i /root/inventory/pod_settings.yaml \
+ -d /etc/opnfv-apex/${DEPLOY_SCENARIO}.yaml \
+ -n /root/network/network_settings.yaml --debug
+ else
+ echo "File does not exist /etc/opnfv-apex/${DEPLOY_SCENARIO}.yaml"
+ exit 1
+ fi
+ else
+ echo "Deploy scenario not set!"
+ exit 1
+ fi
+else
+ echo "File /etc/opnfv-apex/network_settings.yaml does not exist!"
+ exit 1
+fi
+
+echo
+echo "--------------------------------------------------------"
+echo "Done!"