weblate/ci/prepare-database
Michal Čihař b0965696f6 CI: Fail in case of script failure
Otherwise we end up with not configured database without a clear error
from this step.
2021-01-03 13:08:16 +01:00

20 lines
457 B
Bash
Executable file

#!/bin/sh
. ci/lib
set -e
cleanup_database
if [ $CI_DATABASE = "mysql" -o $CI_DATABASE = 'mariadb' ] ; then
mysql $(get_mysql_args) -e 'SHOW VARIABLES LIKE "%version%";'
fi
if [ $CI_DATABASE = "postgresql" ] ; then
if [ -n "$CI_DB_PASSWORD" ] ; then
export PGPASSWORD="$CI_DB_PASSWORD"
fi
if [ -n "$CI_DB_PORT" ] ; then
export PGPORT="$CI_DB_PORT"
fi
psql --host=$CI_DB_HOST -c 'SELECT version();' -U postgres
fi