From 0c1ce8c1ae00de21c813b18ffd5c7d6b0cc00c7e Mon Sep 17 00:00:00 2001
From: Fatih Degirmenci <fatih.degirmenci@ericsson.com>
Date: Fri, 5 Feb 2016 08:43:50 +0100
Subject: compass: Adjust jjb and scripts

- Checkout the commit that was used for building the ISO to have consistency
- Switch to include-raw-escape and get rid of extra/escape curly brackets

Change-Id: I8f879b39d310ac14d72f77e260c7e80e0bf33e39
Signed-off-by: Fatih Degirmenci <fatih.degirmenci@ericsson.com>
---
 jjb/compass4nfv/compass-ci-jobs.yml      |  6 +++---
 jjb/compass4nfv/compass-deploy.sh        | 26 ++++++++++++++++++++------
 jjb/compass4nfv/compass-project-jobs.yml | 12 ++++++------
 3 files changed, 29 insertions(+), 15 deletions(-)

diff --git a/jjb/compass4nfv/compass-ci-jobs.yml b/jjb/compass4nfv/compass-ci-jobs.yml
index a4be24ec0..b0556d09d 100644
--- a/jjb/compass4nfv/compass-ci-jobs.yml
+++ b/jjb/compass4nfv/compass-ci-jobs.yml
@@ -168,11 +168,11 @@
 
     builders:
         - shell:
-            !include-raw: ./compass-workspace-precleanup.sh
+            !include-raw-escape: ./compass-workspace-precleanup.sh
         - shell:
-            !include-raw: ./compass-download-artifact.sh
+            !include-raw-escape: ./compass-download-artifact.sh
         - shell:
-            !include-raw: ./compass-deploy.sh
+            !include-raw-escape: ./compass-deploy.sh
 
     publishers:
         - archive:
diff --git a/jjb/compass4nfv/compass-deploy.sh b/jjb/compass4nfv/compass-deploy.sh
index 697a1d573..860f5da1b 100644
--- a/jjb/compass4nfv/compass-deploy.sh
+++ b/jjb/compass4nfv/compass-deploy.sh
@@ -6,24 +6,38 @@ echo "Starting the deployment on baremetal environment using $INSTALLER_TYPE. Th
 echo "--------------------------------------------------------"
 echo
 
+# source the properties file so we get OPNFV vars
+source $BUILD_DIRECTORY/latest.properties
+
+# echo the info about artifact that is used during the deployment
+echo "Using ${OPNFV_ARTIFACT_URL/*\/} for deployment"
+
+if [[ ! "$JOB_NAME" =~ (verify|merge) ]]; then
+    # for none-merge deployments
+    # 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"
+    git checkout $OPNFV_GIT_SHA1 --quiet
+fi
+
 echo 1 > /proc/sys/vm/drop_caches
 
 export CONFDIR=$WORKSPACE/deploy/conf
 export ISO_URL=file://$BUILD_DIRECTORY/compass.iso
 if [[ "$NODE_NAME" =~ "-vm" ]]; then
     export NETWORK_CONF=$CONFDIR/vm_environment/$NODE_NAME/network.yml
-    export DHA_CONF=$CONFDIR/vm_environment/${{DEPLOY_SCENARIO}}.yml
+    export DHA_CONF=$CONFDIR/vm_environment/${DEPLOY_SCENARIO}.yml
 else
     export INSTALL_NIC=eth1
     export NETWORK_CONF=$CONFDIR/hardware_environment/$NODE_NAME/network.yml
-    export DHA_CONF=$CONFDIR/hardware_environment/$NODE_NAME/${{DEPLOY_SCENARIO}}.yml
+    export DHA_CONF=$CONFDIR/hardware_environment/$NODE_NAME/${DEPLOY_SCENARIO}.yml
 fi
 
 cd $WORKSPACE
 
-export OS_VERSION=${{COMPASS_OS_VERSION}}
-export OPENSTACK_VERSION=${{COMPASS_OPENSTACK_VERSION}}
-./deploy.sh --dha ${{DHA_CONF}} --network ${{NETWORK_CONF}}
+export OS_VERSION=${COMPASS_OS_VERSION}
+export OPENSTACK_VERSION=${COMPASS_OPENSTACK_VERSION}
+./deploy.sh --dha ${DHA_CONF} --network ${NETWORK_CONF}
 if [ $? -ne 0 ]; then
     echo "depolyment failed!"
     deploy_ret=1
@@ -34,6 +48,6 @@ echo "--------------------------------------------------------"
 echo "Done!"
 
 ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
-sshpass -p root scp 2>/dev/null $ssh_options root@${{INSTALLER_IP}}:/var/ansible/run/openstack_${{COMPASS_OPENSTACK_VERSION}}-opnfv2/ansible.log ./  &> /dev/null
+sshpass -p root scp 2>/dev/null $ssh_options root@${INSTALLER_IP}:/var/ansible/run/openstack_${COMPASS_OPENSTACK_VERSION}-opnfv2/ansible.log ./  &> /dev/null
 
 exit $deploy_ret
diff --git a/jjb/compass4nfv/compass-project-jobs.yml b/jjb/compass4nfv/compass-project-jobs.yml
index 8943afb37..11e1d5f8a 100644
--- a/jjb/compass4nfv/compass-project-jobs.yml
+++ b/jjb/compass4nfv/compass-project-jobs.yml
@@ -116,9 +116,9 @@
 
     builders:
         - shell:
-            !include-raw: ./compass-build.sh
+            !include-raw-escape: ./compass-build.sh
         - shell:
-            !include-raw: ./compass-deploy.sh
+            !include-raw-escape: ./compass-deploy.sh
 
     publishers:
         - archive:
@@ -157,11 +157,11 @@
 
     builders:
         - shell:
-            !include-raw: ./compass-build.sh
+            !include-raw-escape: ./compass-build.sh
         - shell:
-            !include-raw: ./compass-upload-artifact.sh
+            !include-raw-escape: ./compass-upload-artifact.sh
         - shell:
-            !include-raw: ./compass-workspace-cleanup.sh
+            !include-raw-escape: ./compass-workspace-cleanup.sh
 
 - job-template:
     name: 'compass-build-ppa-{stream}'
@@ -194,7 +194,7 @@
 
     builders:
         - shell:
-            !include-raw: ./compass-makeppa.sh
+            !include-raw-escape: ./compass-makeppa.sh
 
 
 
-- 
cgit