2015-10-15 01:47:42 +02:00
|
|
|
#!/bin/bash
|
2017-06-06 03:15:17 +02:00
|
|
|
# In short, this provisions a Zulip development environment and then
|
|
|
|
# builds a Zulip release tarball (the same way we build them for an
|
|
|
|
# actual release). The actual test job will then install that.
|
|
|
|
#
|
|
|
|
# This script is more complicated than that, basically because Travis
|
|
|
|
# CI installs a ton of crap in its build workers, and we need to
|
|
|
|
# remove some and reconfigure others to make things run smoothly and
|
|
|
|
# quickly.
|
|
|
|
#
|
2017-11-16 19:51:44 +01:00
|
|
|
# More description in https://zulip.readthedocs.io/en/latest/testing/travis.html.
|
2015-10-15 01:47:42 +02:00
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
2016-06-28 21:02:53 +02:00
|
|
|
# Make /home/travis world-readable so the `zulip` user will be able to
|
2017-06-06 03:15:17 +02:00
|
|
|
# read it, since that's where we store our caches.
|
2016-06-28 21:02:53 +02:00
|
|
|
sudo chmod a+rX /home/travis
|
|
|
|
|
2016-01-19 20:44:21 +01:00
|
|
|
# Uninstall the unnecessary extra versions of postgres that Travis CI
|
|
|
|
# installs since if we don't do this, doing apt upgrades can fail due
|
|
|
|
# to conflicts over which version of postgres should be running.
|
2017-02-20 19:04:00 +01:00
|
|
|
sudo apt-get remove postgresql-9.2 postgresql-client-9.2 postgresql-contrib-9.2 postgresql-9.4 postgresql-client-9.4 postgresql-9.5 postgresql-contrib-9.5 postgresql-client-9.5 postgresql-9.6 postgresql-contrib-9.6 postgresql-client-9.6 -y
|
2016-01-19 20:44:21 +01:00
|
|
|
|
2017-10-09 05:05:21 +02:00
|
|
|
# Remove some of Travis's' stupid extra sources.list files
|
|
|
|
sudo rm -f /etc/apt/sources.list.d/mongodb*.list
|
|
|
|
|
2017-06-13 21:54:52 +02:00
|
|
|
# Provisioning may fail due to many issues but most of the times a network
|
|
|
|
# connection issue is the reason. So we are going to retry entire provisioning
|
|
|
|
# once again if that fixes our problem.
|
2017-10-06 08:12:16 +02:00
|
|
|
if ! tools/provision --production-travis; then
|
2017-06-13 21:54:52 +02:00
|
|
|
echo "\`provision\`: Something went wrong with the provisioning, might be a network issue, Retrying to provision..."
|
2017-10-06 08:12:16 +02:00
|
|
|
tools/provision --production-travis
|
2017-06-13 21:54:52 +02:00
|
|
|
fi
|
2017-01-14 11:19:26 +01:00
|
|
|
|
2016-05-08 03:19:48 +02:00
|
|
|
cp -a tools/travis/success-http-headers.txt ~/
|
2016-07-18 23:22:10 +02:00
|
|
|
source tools/travis/activate-venv
|
2016-11-22 07:00:12 +01:00
|
|
|
|
2016-12-01 20:20:52 +01:00
|
|
|
# Force OpenJDK 8 JRE. This is a workaround for Travis CI having
|
|
|
|
# broken their java install, but also nicely provides consistency.
|
|
|
|
sudo ln -nsf /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java /usr/bin/java
|
|
|
|
|
2017-08-09 01:33:14 +02:00
|
|
|
if ! env TRAVIS=1 ./tools/build-release-tarball travis; then
|
2016-07-13 03:12:03 +02:00
|
|
|
echo "Attempting to output failure logging data"
|
2016-12-01 19:47:40 +01:00
|
|
|
cat /tmp/tmp.*/update-prod-static.log || true
|
2016-07-13 03:12:03 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
2015-10-15 01:47:42 +02:00
|
|
|
mv /tmp/tmp.*/zulip-server-travis.tar.gz ./
|
|
|
|
|
2016-12-08 08:06:24 +01:00
|
|
|
|
2015-10-15 01:47:42 +02:00
|
|
|
# Shut down all services so that restarting postgres and rebuilding
|
|
|
|
# the postgres database to match the prod installation setup will work.
|
|
|
|
sudo supervisorctl stop all
|
|
|
|
# Clear memcached to avoid contamination between development and prod
|
|
|
|
# environments.
|
|
|
|
sudo /etc/init.d/memcached restart
|
|
|
|
|
|
|
|
# Drop any open connections to the development postgres installation.
|
|
|
|
sudo "$(dirname "$0")/../../scripts/setup/terminate-psql-sessions" postgres zulip zulip_base
|
|
|
|
|
|
|
|
# Remove and recreate the postgres database
|
|
|
|
sudo pg_ctlcluster 9.3 main stop
|
|
|
|
sudo pg_dropcluster 9.3 main
|
|
|
|
sudo rm -rf /etc/postgresql/9.3/main /var/lib/postgresql/9.3/main
|
|
|
|
sudo pg_createcluster 9.3 main
|