2014-04-03 00:32:41 +02:00
|
|
|
#!/bin/bash
|
2014-04-01 22:17:03 +02:00
|
|
|
#
|
2017-11-08 09:38:02 +01:00
|
|
|
# this is the script run by the Jenkins server to run the build tests. Be
|
|
|
|
# sure to always run it in its dir, i.e. ./jenkins-build, otherwise it might
|
2014-04-01 22:17:03 +02:00
|
|
|
# remove things that you don't want it to.
|
2017-11-08 09:40:10 +01:00
|
|
|
#
|
|
|
|
# runs here:
|
|
|
|
# https://jenkins.debian.net/job/reproducible_fdroid_build_apps
|
|
|
|
|
2014-04-01 22:17:03 +02:00
|
|
|
|
|
|
|
if [ `dirname $0` != "." ]; then
|
|
|
|
echo "only run this script like ./`basename $0`"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2017-05-22 17:36:18 +02:00
|
|
|
# jenkins.debian.net slaves do not export WORKSPACE
|
|
|
|
if [ -z $WORKSPACE ]; then
|
|
|
|
export WORKSPACE=`pwd`
|
|
|
|
fi
|
|
|
|
|
2018-09-24 12:15:46 +02:00
|
|
|
if [ -z $LC_ALL ] || [ $LC_ALL == "C.UTF-8" ] || [[ $LC_ALL != *.UTF-8 ]]; then
|
2018-10-17 17:17:16 +02:00
|
|
|
for var in `set | grep -Eo '^(LANG|LC_[A-Z]+)' | sort -u`; do
|
|
|
|
unset $var
|
|
|
|
done
|
2018-09-24 12:15:46 +02:00
|
|
|
export LC_ALL=en_US.UTF-8
|
2018-10-17 17:17:16 +02:00
|
|
|
echo "Forced locale to ${LC_ALL}:"
|
|
|
|
set | grep -E '^(LANG|LC_[A-Z]+)'
|
2018-09-24 12:15:46 +02:00
|
|
|
fi
|
|
|
|
|
2014-04-01 22:17:03 +02:00
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
2017-05-22 17:36:18 +02:00
|
|
|
# report info about virtualization
|
|
|
|
(dmesg | grep -i -e hypervisor -e qemu -e kvm) || true
|
|
|
|
(lspci | grep -i -e virtio -e virtualbox -e qemu -e kvm) || true
|
|
|
|
lsmod
|
|
|
|
if systemd-detect-virt -q ; then
|
|
|
|
echo "Virtualization is used:" `systemd-detect-virt`
|
|
|
|
else
|
|
|
|
echo "No virtualization is used."
|
|
|
|
fi
|
2017-10-27 21:21:56 +02:00
|
|
|
echo 'maximum allowed number of open file descriptors: ' `ulimit -n`
|
2017-05-22 17:36:18 +02:00
|
|
|
ls -lR ~/.vagrant.d/ || echo no access
|
|
|
|
cat /etc/issue
|
|
|
|
|
|
|
|
/sbin/ifconfig || true
|
|
|
|
hostname || true
|
|
|
|
|
|
|
|
# point to the Vagrant/VirtualBox configs created by reproducible_setup_fdroid_build_environment.sh
|
|
|
|
# these variables are actually set in fdroidserver/jenkins-build-makebuildserver
|
2017-11-07 15:53:59 +01:00
|
|
|
export SETUP_WORKSPACE=$(dirname $WORKSPACE)/reproducible_setup_fdroid_build_environment
|
2017-05-22 17:36:18 +02:00
|
|
|
export XDG_CONFIG_HOME=$SETUP_WORKSPACE
|
|
|
|
export VBOX_USER_HOME=$SETUP_WORKSPACE/VirtualBox
|
|
|
|
export VAGRANT_HOME=$SETUP_WORKSPACE/vagrant.d
|
|
|
|
|
2017-11-07 15:53:59 +01:00
|
|
|
# make sure we have the right buildserver paths and its ready for use
|
2017-12-14 10:41:02 +01:00
|
|
|
vagrant global-status \
|
2018-09-05 14:37:06 +02:00
|
|
|
| grep -F -e reproducible_setup_fdroid_build_environment -o -e fdroiddata/builder \
|
|
|
|
|| (echo ERROR no buildserver VM found, exiting; exit 1)
|
2017-05-22 17:36:18 +02:00
|
|
|
|
|
|
|
# the way we handle jenkins slaves doesn't copy the workspace to the slaves
|
|
|
|
# so we need to "manually" clone the git repo here…
|
|
|
|
cd $WORKSPACE
|
|
|
|
|
|
|
|
# set up Android SDK to use the Debian packages in stretch
|
|
|
|
export ANDROID_HOME=/usr/lib/android-sdk
|
|
|
|
|
|
|
|
# now build the whole archive
|
|
|
|
cd $WORKSPACE
|
|
|
|
|
|
|
|
# this can be handled in the jenkins job, or here:
|
|
|
|
if [ -e fdroiddata ]; then
|
|
|
|
cd fdroiddata
|
2017-11-27 10:06:47 +01:00
|
|
|
while ! git fetch origin --tags --prune; do sleep 10; done
|
2017-05-22 17:36:18 +02:00
|
|
|
git checkout master
|
|
|
|
git reset --hard origin/master
|
2017-11-07 15:53:59 +01:00
|
|
|
# keep all the cloned source repos
|
2017-11-10 22:08:31 +01:00
|
|
|
git clean -fdx --exclude build --exclude repo --exclude unsigned
|
2017-05-22 17:36:18 +02:00
|
|
|
else
|
|
|
|
git clone https://gitlab.com/fdroid/fdroiddata.git fdroiddata
|
|
|
|
cd fdroiddata
|
|
|
|
fi
|
|
|
|
|
2020-10-22 23:34:47 +02:00
|
|
|
echo "build_server_always: true" > config.yml
|
|
|
|
echo "deploy_process_logs: true" >> config.yml
|
2018-01-11 16:47:49 +01:00
|
|
|
# if the local mediawiki is available, then use it
|
|
|
|
if nc -z -w1 localhost 32445; then
|
|
|
|
wikiflag="--wiki"
|
2020-10-22 23:34:47 +02:00
|
|
|
echo "wiki_protocol: http" >> config.yml
|
|
|
|
echo "wiki_server: localhost:32445" >> config.yml
|
|
|
|
echo "wiki_path: /mediawiki/" >> config.yml
|
|
|
|
echo "wiki_user: fdroid" >> config.yml
|
|
|
|
echo "wiki_password: update.TestCase" >> config.yml
|
2018-01-11 16:47:49 +01:00
|
|
|
else
|
2020-10-22 23:34:47 +02:00
|
|
|
sed -i '/^wiki_/d' config.yml
|
2018-01-11 16:47:49 +01:00
|
|
|
fi
|
|
|
|
|
2021-03-23 10:43:15 +01:00
|
|
|
# force global timeout to 6 hours
|
2021-03-23 11:58:58 +01:00
|
|
|
sed -Ei 's,^(\s+endtime\s*=\s*time\.time\(\))\s*.*,\1 + 6 * 60 * 60 # 6 hours,' \
|
|
|
|
$WORKSPACE/fdroidserver/build.py
|
2021-03-23 10:43:15 +01:00
|
|
|
|
2018-01-11 16:47:49 +01:00
|
|
|
$WORKSPACE/fdroid build --verbose --latest --no-tarball --all $wikiflag
|
2017-05-22 17:36:18 +02:00
|
|
|
|
|
|
|
vagrant global-status
|
2018-01-11 23:25:24 +01:00
|
|
|
if [ -d builder ]; then
|
|
|
|
cd builder
|
|
|
|
vagrant status
|
|
|
|
fi
|