Files
docker-docs/buildscripts/integrationtest.sh
2016-05-24 17:31:55 -07:00

40 lines
828 B
Bash
Executable File

#!/usr/bin/env bash
composeFile="$1"
function cleanup {
rm -f bin/notary
docker-compose -f $composeFile kill
# if we're in CircleCI, we cannot remove any containers
if [[ -z "${CIRCLECI}" ]]; then
docker-compose -f $composeFile down -v --remove-orphans
fi
}
function cleanupAndExit {
cleanup
# Check for existence of SUCCESS
ls test_output/SUCCESS
exitCode=$?
# Clean up test_output dir (if not in CircleCI) and exit
if [[ -z "${CIRCLECI}" ]]; then
rm -rf test_output
fi
exit $exitCode
}
if [[ -z "${CIRCLECI}" ]]; then
BUILDOPTS="--force-rm"
fi
set -e
set -x
cleanup
docker-compose -f $composeFile config
docker-compose -f $composeFile build ${BUILDOPTS} --pull | tee
docker-compose -f $composeFile up --abort-on-container-exit
trap cleanupAndExit SIGINT SIGTERM EXIT