Merge "Migrate docs jobs to use lf-infra-publish"
[releng/builder.git] / jjb / netvirt / include-raw-openstack-ci.sh
index 9e9ff8fcb9ad4b10fd599b6aac06cba045e13518..46067683360527a3f7a9fdef3e266b71cdaa3d43 100644 (file)
@@ -5,7 +5,7 @@
 #
 # https://github.com/openstack-infra/project-config/blob/master/jenkins/jobs/networking-odl.yaml
 
-export PATH=$PATH:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin
+export PATH="$PATH:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin"
 
 # *SIGH*. This is required to get lsb_release
 sudo yum -y install redhat-lsb-core indent python-testrepository
@@ -17,18 +17,18 @@ sudo chown -R jenkins:jenkins /opt/stack/new
 sudo bash -c 'echo "stack ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers'
 
 # We need to install some scripts from openstack/os-testr project
-cd ~
+cd ~ || exit 1
 echo "Setting up infra scripts"
 sudo mkdir -p /usr/local/jenkins/slave_scripts
 git clone https://github.com/openstack/os-testr.git
-cd os-testr/os_testr
+cd os-testr/os_testr || exit 1
 sudo cp subunit2html.py /usr/local/jenkins/slave_scripts
 
 # Save existing WORKSPACE
-SAVED_WORKSPACE=$WORKSPACE
+SAVED_WORKSPACE="$WORKSPACE"
 export WORKSPACE=~/workspace
-mkdir -p $WORKSPACE
-cd $WORKSPACE
+mkdir -p "$WORKSPACE"
+cd "$WORKSPACE" || exit 1
 
 # This is the job which checks out devstack-gate
 if [[ ! -e devstack-gate ]]; then
@@ -36,7 +36,7 @@ if [[ ! -e devstack-gate ]]; then
     git clone https://git.openstack.org/openstack-infra/devstack-gate
 else
     echo "Fixing devstack-gate git remotes"
-    cd devstack-gate
+    cd devstack-gate || exit 1
     git remote set-url origin https://git.openstack.org/openstack-infra/devstack-gate
     git remote update
     git reset --hard
@@ -55,11 +55,11 @@ fi
 
 # Set the pieces we want to test
 if [ "$GERRIT_PROJECT" == "openstack/neutron" ]; then
-    ZUUL_PROJECT=$GERRIT_PROJECT
-    ZUUL_BRANCH=$GERRIT_REFSPEC
+    export ZUUL_PROJECT=$GERRIT_PROJECT
+    export ZUUL_BRANCH=$GERRIT_REFSPEC
 elif [ "$GERRIT_PROJECT" == "openstack-dev/devstack" ]; then
-    ZUUL_PROJECT=$GERRIT_PROJECT
-    ZUUL_BRANCH=$GERRIT_REFSPEC
+    export ZUUL_PROJECT=$GERRIT_PROJECT
+    export ZUUL_BRANCH=$GERRIT_REFSPEC
 fi
 
 echo "Setting environment variables"
@@ -72,7 +72,7 @@ DEVSTACK_LOCAL_CONFIG+="ODL_JAVA_MAX_MEM=784m;"
 DEVSTACK_LOCAL_CONFIG+="ODL_JAVA_MAX_PERM_MEM=784m;"
 
 # Set ODL_URL_PREFIX if "nexus proxy" is provided
-URL_PREFIX=${ODLNEXUSPROXY:-https://nexus.opendaylight.org}
+export URL_PREFIX="${ODLNEXUSPROXY:-https://nexus.opendaylight.org}"
 if [ -n "$ODLNEXUSPROXY" ] ; then
     DEVSTACK_LOCAL_CONFIG+="ODL_URL_PREFIX=$ODLNEXUSPROXY;"
 fi
@@ -83,8 +83,6 @@ fi
 # Use specific build, if asked to do so
 if [ "${ODL_VERSION}" == "beryllium" ] ; then
     DEVSTACK_LOCAL_CONFIG+="ODL_RELEASE=beryllium-snapshot-0.4.0;"
-elif [ "${ODL_VERSION}" == "lithium" ] ; then
-    DEVSTACK_LOCAL_CONFIG+="ODL_RELEASE=lithium-snapshot-0.3.1;"
 fi
 
 # And this runs devstack-gate
@@ -130,17 +128,17 @@ echo "Running safe-devstack-vm-gate-wrap.sh"
 DGRET=$?
 
 # Restore WORKSPACE
-OS_WORKSPACE=$WORKSPACE
-export WORKSPACE=$SAVED_WORKSPACE
+OS_WORKSPACE="$WORKSPACE"
+export WORKSPACE="$SAVED_WORKSPACE"
 
 # Copy and display all the logs
 cat /opt/stack/new/devstacklog*
 ls /opt/stack/; ls /opt/stack/new; ls /opt/stack/new/opendaylight;
-cp -r $OS_WORKSPACE/logs $WORKSPACE
-cp -a /opt/stack/new/logs/screen-odl-karaf* $WORKSPACE/logs
-mkdir -p $WORKSPACE/logs/opendaylight
-cp -a /opt/stack/new/opendaylight/distribution*/etc $WORKSPACE/logs/opendaylight
+cp -r "$OS_WORKSPACE/logs" "$WORKSPACE"
+cp -a /opt/stack/new/logs/screen-odl-karaf* "$WORKSPACE/logs"
+mkdir -p "$WORKSPACE/logs/opendaylight"
+cp -a /opt/stack/new/opendaylight/distribution*/etc "$WORKSPACE/logs/opendaylight"
 # Unzip the logs to make them easier to view
-gunzip $WORKSPACE/logs/*.gz
+gunzip "$WORKSPACE"/logs/*.gz
 
-exit $DGRET
+exit "$DGRET"