chiark / gitweb /
complete-ci-tests: exit with error if setup is not correct
[fdroidserver.git] / jenkins-build-makebuildserver
1 #!/bin/bash
2
3 if [ `dirname $0` != "." ]; then
4     echo "only run this script like ./`basename $0`"
5     exit
6 fi
7
8 if [ -z $WORKSPACE ]; then
9     WORKSPACE=`pwd`
10 fi
11
12 # make sure that no VirtualBox processes are left running
13 cleanup_all() {
14     echo "$(date -u) - cleanup in progress..."
15     ps auxww|grep VBox
16     cd $WORKSPACE/buildserver
17     vagrant halt || true
18     sleep 5
19     killall VBoxHeadless || true
20     sleep 5
21     killall -9 VBoxHeadless || true
22     echo "$(date -u) - cleanup done."
23 }
24 trap cleanup_all INT TERM EXIT
25
26 set -e
27 set -x
28
29 # make sure we have the vagrant box image cached
30 test -e ~/.cache/fdroidserver || mkdir -p ~/.cache/fdroidserver
31 cd ~/.cache/fdroidserver
32 wget --tries=1 --timeout=5 --continue https://f-droid.org/jessie32.box || true
33 echo "ff6b0c0bebcb742783becbc51a9dfff5a2a0a839bfcbfd0288dcd3113f33e533  jessie32.box" > jessie32.box.sha256
34 sha256sum -c jessie32.box.sha256
35
36 # redirect homes to be in the git repo, so they'll get cleaned and reset
37 export XDG_CONFIG_HOME=$WORKSPACE
38 export VBOX_USER_HOME=$WORKSPACE/VirtualBox
39 mkdir $VBOX_USER_HOME
40 VBoxManage setproperty machinefolder $WORKSPACE/virtualbox.d
41 VBoxManage setproperty logginglevel debug
42 export VAGRANT_HOME=$WORKSPACE/vagrant.d
43 mkdir $VAGRANT_HOME
44
45 cd $WORKSPACE
46 echo "debian_mirror = 'http://ftp.uk.debian.org/debian/'" > $WORKSPACE/makebuildserver.config.py
47 echo "boot_timeout = 1200" >> $WORKSPACE/makebuildserver.config.py
48 echo "apt_package_cache = True" >> $WORKSPACE/makebuildserver.config.py
49 ./makebuildserver
50
51 # this can be handled in the jenkins job, or here:
52 if [ ! -e fdroiddata ]; then
53     git clone --depth 1 --branch master --single-branch \
54         https://gitlab.com/fdroid/fdroiddata.git fdroiddata
55 fi
56 cd fdroiddata
57 echo "build_server_always = True" > config.py
58 ../fdroid build info.guardianproject.checkey