This page documents progress in setting up a Travis CI build for Stratos.  The idea to use Travis CI was to automatically build and test Github Pull Requests

There are some constraints with Travis:

  • No output from build for a period of 10 mins is assumed to be a failure with the build
  • Output from build script not allowed to exceed 4MB
  • Maximum build duration is 50 minutes

To work around the first two constraints, a custom  build script was created:

install: false
script: "./travis_build.sh"
jdk:
  - oraclejdk7

 

The custom build script echos a single line to the build output every 30 seconds.  The real output from the build is redirected to a file.  The last 500 lines from the file are output on error or job completion:

#!/bin/bash
# Abort on Error
set -e

export PING_SLEEP=30s
export WORKDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export BUILD_OUTPUT=$WORKDIR/build.out
touch $BUILD_OUTPUT

dump_mvn_output() {
   echo Tailing the last 500 lines of mvn output:
   tail -500 $BUILD_OUTPUT  
}

error() {
  echo ERROR: An error was encountered with the build.
  dump_mvn_output
  exit 1
}
trap 'error' ERR

# Travis aborts the build if no output is seen for 10 mins. Therefore, set up a repeating loop to send some output to Travis.
bash -c "while true; do echo \$(date) - building ...; sleep $PING_SLEEP; done" &
PING_LOOP_PID=$!

export MAVEN_OPTS="-Xms512m -Xmx1024m -XX:MaxPermSize=1024m -XX:ReservedCodeCacheSize=256m -XX:-UseGCOverheadLimit -XX:+UseConcMarkSweepGC" 

mvn clean install -P cli-test integration-test >> $BUILD_OUTPUT 2>&1
dump_mvn_output

kill $PING_LOOP_PID

 

Unfortunately, the build duration consistently exceeded the 50 mins allowed and therefore failed.

Future Steps:

When STRATOS-797 has been resolved, it should be possible to cut the build back to just mvn clean install -DskipTests from Travis potentially allowing the build to finish within the 50 minute window.

It is hoped that the 50 min limitation will be addressed some point in the future.  

 

  • No labels