[Functest] Push logs to artifacts regardless if loop fails 01/19901/3
authorjose.lausuch <jose.lausuch@ericsson.com>
Tue, 30 Aug 2016 14:49:36 +0000 (16:49 +0200)
committerjose.lausuch <jose.lausuch@ericsson.com>
Wed, 31 Aug 2016 12:20:53 +0000 (14:20 +0200)
This prevents from exiting the job without pushing the logs
to artifacts if the functest loop fails.

JIRA: FUNCTEST-443

Change-Id: I6925b5855326df809dbce9f389b10be8a00cf8de
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
jjb/functest/functest-ci-jobs.yml
jjb/functest/functest-exit.sh [new file with mode: 0644]
jjb/functest/functest-loop.sh

index 8e3de3d..3070c25 100644 (file)
         - 'set-functest-env'
         - 'functest-daily'
         - 'functest-store-results'
+        - 'functest-exit'
 
 - builder:
     name: functest-weekly-builder
         - 'set-functest-env'
         - 'functest-weekly'
         - 'functest-store-results'
+        - 'functest-exit'
 
 - builder:
     name: functest-suite-builder
         - 'functest-cleanup'
         - 'set-functest-env'
         - 'functest-suite'
+        - 'functest-exit'
 
 - builder:
     name: functest-daily
     builders:
         - shell:
             !include-raw: ./functest-cleanup.sh
+
+- builder:
+    name: functest-exit
+    builders:
+        - shell:
+            !include-raw: ./functest-exit.sh
\ No newline at end of file
diff --git a/jjb/functest/functest-exit.sh b/jjb/functest/functest-exit.sh
new file mode 100644 (file)
index 0000000..f2aa2d0
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+branch=${GIT_BRANCH##*/}
+ret_val_file="${HOME}/opnfv/functest/results/${branch}/return_value"
+if [ ! -f ${ret_val_file} ]; then
+    echo "Return value not found!"
+    exit -1
+fi
+
+ret_val=`cat ${ret_val_file}`
+
+exit ret_val
\ No newline at end of file
index 5abddfd..7385623 100755 (executable)
@@ -10,3 +10,9 @@ else
 fi
 container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
 docker exec $container_id $cmd
+
+ret_value=$?
+ret_val_file="${HOME}/opnfv/functest/results/${branch}/return_value"
+echo ${ret_value}>${ret_val_file}
+
+exit 0
\ No newline at end of file