Backporting integration-tests (#155)

This commit is contained in:
Alberto C. Ríos
2023-09-14 15:48:25 +02:00
committed by GitHub
parent 68795799fe
commit 9dcf565c2f
6 changed files with 164 additions and 22 deletions

View File

@@ -2,17 +2,32 @@
set -euo pipefail
readonly SKIP_TESTS="${SKIP_TESTS:-false}"
# shellcheck source=common.sh
source "$(dirname "$0")/common.sh"
repository=$(pwd)/distribution-repository
if [ "$SKIP_TESTS" == "true" ]; then
build_task=assemble
else
build_task=build
fi
pushd git-repo >/dev/null
./gradlew clean "${build_task}" publish -PpublicationRepository="${repository}"
popd >/dev/null
start_docker() {
pushd credhub-server >/dev/null
echo '{"registry-mirrors": ["https://harbor-mirror.spring.vmware.com"]}' > /etc/docker/daemon.json
service cgroupfs-mount start
service docker start
docker-compose up --detach
trap "stop_docker" EXIT
popd >/dev/null
}
stop_docker() {
pushd credhub-server >/dev/null
docker-compose stop
service cgroupfs-mount stop
service docker stop
popd >/dev/null
}
main() {
cd git-repo >/dev/null
start_docker
./gradlew build publish -PpublicationRepository="${repository}" -PintegrationTests --no-parallel
}
main