aboutsummaryrefslogtreecommitdiffstats
path: root/jenkins-common.sh
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-04-09 15:46:57 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2018-05-02 09:36:57 +0000
commit18392ee604dfc0cc24a34edfeef904700a10c417 (patch)
tree4ffb26ea1b36a8d1429b9e3fa5e6e1f79ef286e8 /jenkins-common.sh
parentaff7d1b4d85e7885f9f7047e66e8b7ce3c6d899b (diff)
jenkins.sh: stay in the jenkins workspace, not in /tmp
On jenkins, place all logs and manage docker volumes in the workspace instead of a /tmp/* dir. Use $WORKSPACE/logs as docker volume base to begin with, thus there needs to be no copy from /tmp to $WORKSPACE/logs. On non-jenkins runs, place all in a /tmp/* dir still, but also skip copying of the logs: just have a /tmp/logs symlink to the last tmpdir. Change-Id: I8cf6014725ae8ba602be5f3ec31dfb8e49ff993e
Diffstat (limited to 'jenkins-common.sh')
-rw-r--r--jenkins-common.sh21
1 files changed, 12 insertions, 9 deletions
diff --git a/jenkins-common.sh b/jenkins-common.sh
index 281807a..515479f 100644
--- a/jenkins-common.sh
+++ b/jenkins-common.sh
@@ -11,8 +11,7 @@ network_remove() {
}
collect_logs() {
- cp -a "$VOL_BASE_DIR"/* "$WORKSPACE"/logs/
- cat "$WORKSPACE"/logs/*/junit-*.log || true
+ cat "$VOL_BASE_DIR"/*/junit-*.log || true
}
set -x
@@ -22,9 +21,18 @@ if [ "x$REPO_USER" = "x" ]; then
REPO_USER=$USER
fi
-# non-jenkins execution: put logs in /tmp
if [ "x$WORKSPACE" = "x" ]; then
- WORKSPACE=/tmp
+ # non-jenkins execution: put logs in /tmp
+ VOL_BASE_DIR="$(mktemp -d)"
+
+ # point /tmp/logs to the last ttcn3 run
+ rm /tmp/logs || true
+ ln -s "$VOL_BASE_DIR" /tmp/logs || true
+else
+ # jenkins execution: put logs in workspace
+ VOL_BASE_DIR="$WORKSPACE/logs"
+ rm -rf "$VOL_BASE_DIR"
+ mkdir -p "$VOL_BASE_DIR"
fi
# non-jenkins execution: put logs in /tmp
@@ -35,8 +43,3 @@ fi
SUITE_NAME=`basename $PWD`
NET_NAME=$SUITE_NAME
-
-VOL_BASE_DIR=`mktemp -d`
-
-rm -rf $WORKSPACE/logs || /bin/true
-mkdir -p $WORKSPACE/logs