Avoid removing the whole file system 75/25975/5
authorNikolas Hermanns <nikolas.hermanns@ericsson.com>
Wed, 14 Dec 2016 14:18:16 +0000 (15:18 +0100)
committerNikolas Hermanns <nikolas.hermanns@ericsson.com>
Fri, 13 Jan 2017 12:56:57 +0000 (13:56 +0100)
If scripts are used by hand and
WORKSPACE is not set then rm -rf /*
will remove the filesystem.

Change-Id: I9bb9ee6643d3916fedc7d3848ecf9b03bde10fae
Signed-off-by: Nikolas Hermanns <nikolas.hermanns@ericsson.com>
jjb/3rd_party_ci/create-apex-vms.sh
jjb/3rd_party_ci/download-netvirt-artifact.sh
jjb/3rd_party_ci/install-netvirt.sh
jjb/3rd_party_ci/postprocess-netvirt.sh

index a076dd0..3f5dbd1 100755 (executable)
@@ -1,11 +1,15 @@
 #!/bin/bash
 set -e
 
+if [ -z ${WORKSPACE} ]; then
+  echo "WORKSPACE is unset. Please do so."
+  exit 1
+fi
 # wipe the WORKSPACE
 /bin/rm -rf $WORKSPACE/*
-
 # clone opnfv sdnvpn repo
 git clone https://gerrit.opnfv.org/gerrit/p/sdnvpn.git $WORKSPACE/sdnvpn
+
 . $WORKSPACE/sdnvpn/odl-pipeline/odl-pipeline-common.sh
 pushd $LIB
 ./test_environment.sh --env-number $APEX_ENV_NUMBER --cloner-info $CLONER_INFO --snapshot-disks $SNAPSHOT_DISKS --vjump-hosts $VIRTUAL_JUMPHOSTS
index 0a48e3a..be2d405 100755 (executable)
@@ -1,6 +1,10 @@
 #!/bin/bash
 set -e
 
+if [ -z ${WORKSPACE} ]; then
+  echo "WORKSPACE is unset. Please do so."
+  exit 1
+fi
 # wipe the WORKSPACE
 /bin/rm -rf $WORKSPACE/*
 
index 96c4b96..f111d48 100755 (executable)
@@ -1,5 +1,12 @@
 #!/bin/bash
 set -e
+
+if [ -z ${WORKSPACE} ]; then
+  echo "WORKSPACE is unset. Please do so."
+  exit 1
+fi
+# wipe the WORKSPACE
+/bin/rm -rf $WORKSPACE/*
 # clone opnfv sdnvpn repo
 git clone https://gerrit.opnfv.org/gerrit/p/sdnvpn.git $WORKSPACE/sdnvpn
 . $WORKSPACE/sdnvpn/odl-pipeline/odl-pipeline-common.sh
index 2e99477..5baf378 100755 (executable)
@@ -1,14 +1,15 @@
 #!/bin/bash
 set -e
 
+if [ -z ${WORKSPACE} ]; then
+  echo "WORKSPACE is unset. Please do so."
+  exit 1
+fi
 # wipe the WORKSPACE
-if [ -z ${WORKSPACE} ]; then echo "WORKSPACE is unset"; else echo "WORKSPACE is set to \"$WORKSPACE\""; fi
-WORKSPACE=${WORKSPACE:-$PWD}
 /bin/rm -rf $WORKSPACE/*
-set -e
 # clone opnfv sdnvpn repo
 git clone https://gerrit.opnfv.org/gerrit/p/sdnvpn.git $WORKSPACE/sdnvpn
 . $WORKSPACE/sdnvpn/odl-pipeline/odl-pipeline-common.sh
 pushd $LIB
 ./post_process.sh
-popd
\ No newline at end of file
+popd