#! /bin/sh -xe

# Go to correct directory.
cd "$(dirname "$0")"

# Decrypt copr token.  For security reasons, the security variable is not
# exported in case of pull request -> thus this is going to fail.
(
    set +x +e # pssst!
    echo "$copr_token_password" | gpg --batch --passphrase-fd 0 rpm/copr-token.gpg
) || exit 0

docker run -e HOME=/git -e PARENT_VERSION -e PROJECT_VERSION \
    -u `id -u` -ti --rm -v `pwd`/..:/git:Z praiskup/copr-and-jdbc-ci \
    copr-ci-git /git/packaging/rpm postgresql-jdbc
