Add new run-diagnostics-suite.sh jenkins script.
[arvados-dev.git] / jenkins / run-diagnostics-suite.sh
1 #!/bin/bash
2
3 EXITCODE=0
4
5 # Sanity check
6 if ! [[ -n "$WORKSPACE" ]]; then
7   echo "WORKSPACE environment variable not set"
8   exit 1
9 fi
10
11 title () {
12     txt="********** $1 **********"
13     printf "\n%*s%s\n\n" $((($COLUMNS-${#txt})/2)) "" "$txt"
14 }
15
16 timer_reset() {
17     t0=$SECONDS
18 }
19
20 timer() {
21     echo -n "$(($SECONDS - $t0))s"
22 }
23
24 source /etc/profile.d/rvm.sh
25 echo $WORKSPACE
26
27 title "Starting diagnostics"
28 timer_reset
29
30 cd $WORKSPACE
31
32 cp -f /home/jenkins/diagnostics/arvados-workbench/application.yml $WORKSPACE/apps/workbench/config/
33
34 cd $WORKSPACE/apps/workbench
35
36 HOME="$GEMHOME" bundle install --no-deployment
37
38 if [[ ! -d tmp ]]; then
39   mkdir tmp
40 fi
41
42 RAILS_ENV=diagnostics bundle exec rake TEST=test/diagnostics/pipeline_test.rb
43
44 ECODE=$?
45
46 if [[ "$ECODE" != "0" ]]; then
47   title "!!!!!! DIAGNOSTICS FAILED (`timer`) !!!!!!"
48   EXITCODE=$(($EXITCODE + $ECODE))
49   exit $EXITCODE
50 fi
51
52 title "Diagnostics complete (`timer`)"
53
54 exit $EXITCODE