Merge "leverage LFID authentication to pod creation"
[releng.git] / jjb / xci / bifrost-verify.sh
index 7624668..03d9afc 100755 (executable)
@@ -57,16 +57,17 @@ EOF
 </html>
 EOF
 
+    # Upload landing page
+    echo "Uploading the landing page"
+    gsutil -q cp ${WORKSPACE}/index.html ${BIFROST_GS_URL}/index.html
+    rm -f ${WORKSPACE}/index.html
+
     # Finally, download and upload the entire build log so we can retain
     # as much build information as possible
     echo "Uploading the final console output"
     curl -s -L ${BIFROST_CONSOLE_LOG} > ${WORKSPACE}/build_log.txt
     gsutil -q cp -Z ${WORKSPACE}/build_log.txt ${BIFROST_GS_URL}/build_log.txt
-    rm ${WORKSPACE}/build_log.txt
-
-    # Upload landing page
-    gsutil -q cp ${WORKSPACE}/index.html ${BIFROST_GS_URL}/index.html
-    rm ${WORKSPACE}/index.html
+    rm -f ${WORKSPACE}/build_log.txt
 }
 
 function fix_ownership() {
@@ -83,44 +84,47 @@ function fix_ownership() {
 
 function cleanup_and_upload() {
     original_exit=$?
+    echo "Job exit code: $original_exit"
+    # Turn off errexit
+    set +o errexit
     fix_ownership
     upload_logs
     exit $original_exit
 }
 
 # check distro to see if we support it
-if [[ ! "$DISTRO" =~ (trusty|centos7|suse) ]]; then
+if [[ ! "$DISTRO" =~ (xenial|centos7|suse) ]]; then
     echo "Distro $DISTRO is not supported!"
     exit 1
 fi
 
 # remove previously cloned repos
-sudo /bin/rm -rf /opt/bifrost /opt/stack /opt/releng
+/bin/rm -rf $WORKSPACE/bifrost $WORKSPACE/releng-xci
 
 # Fix up permissions
 fix_ownership
 
 # clone all the repos first and checkout the patch afterwards
-sudo git clone https://git.openstack.org/openstack/bifrost /opt/bifrost
-sudo git clone https://gerrit.opnfv.org/gerrit/releng /opt/releng
+git clone https://git.openstack.org/openstack/bifrost $WORKSPACE/bifrost
+git clone https://gerrit.opnfv.org/gerrit/releng-xci $WORKSPACE/releng-xci
 
 # checkout the patch
 cd $CLONE_LOCATION
-sudo git fetch $PROJECT_REPO $GERRIT_REFSPEC && sudo git checkout FETCH_HEAD
+git fetch $PROJECT_REPO $GERRIT_REFSPEC && sudo git checkout FETCH_HEAD
 
 # combine opnfv and upstream scripts/playbooks
-sudo /bin/cp -rf /opt/releng/prototypes/bifrost/* /opt/bifrost/
+/bin/cp -rf $WORKSPACE/releng-xci/bifrost/* $WORKSPACE/bifrost/
 
 # cleanup remnants of previous deployment
-cd /opt/bifrost
-sudo -E ./scripts/destroy-env.sh
+cd $WORKSPACE/bifrost
+sudo -H -E ./scripts/destroy-env.sh
 
 # provision 3 VMs; xcimaster, controller, and compute
-cd /opt/bifrost
-sudo -E ./scripts/test-bifrost-deployment.sh
+cd $WORKSPACE/bifrost
+./scripts/bifrost-provision.sh
 
 # list the provisioned VMs
-cd /opt/bifrost
+cd $WORKSPACE/bifrost
 source env-vars
 ironic node-list
-virsh list
+sudo -H -E virsh list