github.com/emc-advanced-dev/unik@v0.0.0-20190717152701-a58d3e8e33b7/test/scripts/travis_make_containers.sh (about) 1 #!/bin/bash 2 # from 3 # Abort on Error 4 set -e 5 6 export PING_SLEEP=30s 7 export WORKDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 8 export BUILD_OUTPUT=$WORKDIR/build.out 9 10 touch $BUILD_OUTPUT 11 12 dump_output() { 13 echo Tailing the last 500 lines of output: 14 tail -500 $BUILD_OUTPUT 15 } 16 error_handler() { 17 echo ERROR: An error was encountered with the build. 18 dump_output 19 exit 1 20 } 21 # If an error occurs, run our error handler to output a tail of the build 22 trap 'error_handler' ERR 23 24 # Set up a repeating loop to send some output to Travis. 25 bash -c "while true; do echo \$(date) - building ...; echo Tailing the last 10 lines of output:; tail -10 $BUILD_OUTPUT; sleep $PING_SLEEP; done" & 26 PING_LOOP_PID=$! 27 28 # do the actual build, pipe to BUILD_OUTPUT 29 make $CONTAINER >> $BUILD_OUTPUT 2>&1 30 31 # The build finished without returning an error so dump a tail of the output 32 dump_output 33 34 # nicely terminate the ping output loop 35 kill $PING_LOOP_PID