ci: Update CI to test once with custom db name and user.

Update CI to test once with a custom db name and user so we can test
both scenarios of a custom dbname/user and the default "zulip".
This commit is contained in:
Adam Birds
2021-03-31 12:01:33 +00:00
committed by Tim Abbott
parent 3c28fa033d
commit 9aab03654e
2 changed files with 49 additions and 4 deletions

View File

@@ -113,24 +113,28 @@ jobs:
# Base images are built using `tools/ci/Dockerfile.template`.
# The comments at the top explain how to build and upload these images.
- docker_image: zulip/ci:bionic
name: Bionic production install
name: Bionic production install with custom db name and user
is_bionic: true
os: bionic
install-command: /tmp/production-install --test-custom-db
- docker_image: zulip/ci:focal
name: Focal production install
is_focal: true
os: focal
install-command: /tmp/production-install
- docker_image: zulip/ci:buster
name: Buster production install
is_buster: true
os: buster
install-command: /tmp/production-install
- docker_image: zulip/ci:bullseye
name: Bullseye production install
is_bullseye: true
os: bullseye
install-command: /tmp/production-install
name: ${{ matrix.name }}
container: ${{ matrix.docker_image }}
@@ -181,7 +185,7 @@ jobs:
- name: Install production
run: |
sudo service rabbitmq-server restart
sudo /tmp/production-install
sudo ${{ matrix.install-command }}
- name: Verify install
run: sudo /tmp/production-verify

View File

@@ -4,6 +4,41 @@
set -e
set -x
usage() {
cat <<'EOF'
Usage:
production-install
production-install --test-custom-db
production-install --help
Options:
--test-custom-db
This will instruct the install test to be ran with a custom database name and user.
EOF
}
# Shell option parsing.
args="$(getopt -o '' --long help,test-custom-db -n "$0" -- "$@")"
eval "set -- $args"
while true; do
case "$1" in
--help)
usage
exit 0
;;
--test-custom-db)
TEST_CUSTOM_DB=1
shift
;;
--)
shift
break
;;
esac
done
ZULIP_PATH=/root/zulip-latest
mkdir -p "$ZULIP_PATH"
tar -xf /tmp/zulip-server-test.tar.gz -C "$ZULIP_PATH" --strip-components=1
@@ -45,8 +80,14 @@ if [ "$os_version_codename" = "bionic" ]; then
export POSTGRESQL_VERSION=10
fi
# Install Zulip
"$ZULIP_PATH"/scripts/setup/install --self-signed-cert --hostname 127.0.0.1 --email circleci@example.com
# Install
if [ -z "$TEST_CUSTOM_DB" ]; then
echo "Testing production install with default database name and user."
"$ZULIP_PATH"/scripts/setup/install --self-signed-cert --hostname 127.0.0.1 --email circleci@example.com
else
echo "Testing production install with custom database name and user."
"$ZULIP_PATH"/scripts/setup/install --self-signed-cert --hostname 127.0.0.1 --email circleci@example.com --postgresql-database-user zulipcustomuser --postgresql-database-name zulipcustomdb
fi
if [ "$os_version_codename" = "bionic" ]; then
if [ "$(crudini --get /etc/zulip/zulip.conf postgresql version)" != "10" ]; then