diff --git a/scripts/ci b/scripts/ci index 1d21607dc..bbbbe7322 100755 --- a/scripts/ci +++ b/scripts/ci @@ -12,6 +12,7 @@ IMAGE_TAR="${CACHE_DIR}/${IMAGE}-${IMAGE_TAG}.tar.gz" MYSQL_IMAGE="mysql:5.7" POSTGRES_IMAGE="postgres:9.6" +POSTGRES_CONTAINER="test_postgres" export MYSQL_ROOT_PASSWORD="quay" export MYSQL_USER="quay" @@ -110,13 +111,18 @@ postgres_ping() { postgres_start() { - docker run --net=host -d -e POSTGRES_USER -e POSTGRES_PASSWORD \ + docker run --name="${POSTGRES_CONTAINER}" --net=host -d -e POSTGRES_USER -e POSTGRES_PASSWORD \ -e POSTGRES_DB "${POSTGRES_IMAGE}" if ! (sleep 10 && postgres_ping); then echo "PostgreSQL failed to respond in time." exit 1 - fi + fi +} + + +postgres_init() { + docker exec "${POSTGRES_CONTAINER}" psql -U "${POSTGRES_USER}" -d "${POSTGRES_DB}" -c 'CREATE EXTENSION IF NOT EXISTS pg_trgm;' } @@ -129,6 +135,7 @@ postgres() { load_image postgres_start + postgres_init quay_run make full-db-test }