Merge "Check that variables for exit actions are defined"
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>
Tue, 15 Sep 2020 07:56:29 +0000 (07:56 +0000)
committerGerrit Code Review <gerrit@onap.org>
Tue, 15 Sep 2020 07:56:29 +0000 (07:56 +0000)
run-csit.sh

index 634b0c7..52d1693 100755 (executable)
 
 function on_exit(){
     rc=$?
-    rsync -av "$WORKDIR/" "$WORKSPACE/archives"
-
-    # Record list of active docker containers
-    docker ps --format "{{.Image}}" > "$WORKSPACE/archives/_docker-images.log"
-
-    # show memory consumption after all docker instances initialized
-    docker_stats | tee "$WORKSPACE/archives/_sysinfo-2-after-robot.txt"
-
+    if [[ ${WORKSPACE} ]]; then
+        if [[ ${WORKDIR} ]]; then
+            rsync -av "$WORKDIR/" "$WORKSPACE/archives"
+        fi
+        # Record list of active docker containers
+        docker ps --format "{{.Image}}" > "$WORKSPACE/archives/_docker-images.log"
+
+        # show memory consumption after all docker instances initialized
+        docker_stats | tee "$WORKSPACE/archives/_sysinfo-2-after-robot.txt"
+    fi
     # Run teardown script plan if it exists
     cd "${TESTPLANDIR}"
     TEARDOWN="${TESTPLANDIR}/teardown.sh"