forked from vmware-archive/xenon
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbg-build.sh
executable file
·33 lines (25 loc) · 872 Bytes
/
bg-build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
# Script to build xenon in background for Travis CI.
# Travis CI does not allow output log to be more than 4MB. To overcome this
# limitation we run the mvn build command in background in this script
# and redirect the output in a log file. At the end of build we print last
# few lines from the log file on to the console for debugging purpose.
set -ex
export WORKING_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export OUTPUT_FILE=$WORKING_DIR/output.out
touch $OUTPUT_FILE
print_output() {
echo "Last 1000 lines of output:"
tail -1000 $OUTPUT_FILE
}
handle_error() {
echo "ERROR: Caught an error in the build."
print_output
exit 1
}
trap 'handle_error' ERR
bash -c "while true; do echo \$(date) - building xenon...; sleep 30s; done" &
LOOP_PID=$!
./mvnw install -P coverage >> $OUTPUT_FILE 2>&1
print_output
kill -9 $LOOP_PID