Automatically rotate and compress the test.log files for the api server
authorWard Vandewege <ward@curoverse.com>
Sat, 17 Jan 2015 15:25:50 +0000 (10:25 -0500)
committerWard Vandewege <ward@curoverse.com>
Sat, 17 Jan 2015 15:25:50 +0000 (10:25 -0500)
and workbench.

No issue #

jenkins/run-tests.sh

index e27153696befdc567ae6703c5805e99b186e0e9e..a88d1bc3665abea8db4383076a14b2a1f99b8d7e 100755 (executable)
@@ -168,6 +168,15 @@ sanity_checks() {
 
 }
 
+rotate_logfile() {
+  # $BUILD_NUMBER is set by Jenkins if this script is being called as part of a Jenkins run
+  if [[ -f "$1/$2" ]]; then
+    THEDATE=`date +%Y%m%d%H%M%S`
+    mv "$1/$2" "$1/$THEDATE-$BUILD_NUMBER-$2"
+    gzip "$1/$THEDATE-$2"
+  fi
+}
+
 declare -a failures
 declare -A skip
 declare -A testargs
@@ -542,6 +551,8 @@ test_apiserver() {
 }
 do_test services/api apiserver
 
+rotate_logfile "$WORKSPACE/services/api/log/" "test.log"
+
 for p in "${pythonstuff[@]}"
 do
     do_test "$p" pip
@@ -570,6 +581,8 @@ test_workbench_profile() {
 }
 do_test apps/workbench_profile workbench_profile
 
+rotate_logfile "$WORKSPACE/apps/workbench/log/" "test.log"
+
 report_outcomes
 clear_temp