Merge pull request #3111 from bison/travis-cache-clean

Always clean Travis CI cache if build fails
This commit is contained in:
Brad Ison 2018-06-13 14:15:27 -04:00 committed by GitHub
commit 2b19e1d93f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 35 additions and 13 deletions

View file

@ -13,6 +13,10 @@ before_script:
- sudo service mysql stop
- sudo service postgresql stop
# Clean the cache if any step fails.
before_cache:
- scripts/ci fail-clean
cache:
timeout: 1000
directories:

View file

@ -142,4 +142,4 @@ RUN ./scripts/detect-config.sh
EXPOSE 443 8443 80
ENTRYPOINT [ "/bin/bash", "./quay-entrypoint.sh"]
ENTRYPOINT ["/quay-registry/quay-entrypoint.sh"]

View file

@ -43,19 +43,19 @@ conf/stack/license: $(QUAY_CONFIG)/local/license
ln -s $(QUAY_CONFIG)/local/license conf/stack/license
unit-test:
TEST=true PYTHONPATH="." py.test \
TEST=true PYTHONPATH="." py.test -n 2 \
--cov="." --cov-report=html --cov-report=term-missing \
--timeout=3600 --verbose -x \
./
registry-test:
TEST=true PYTHONPATH="." py.test \
TEST=true PYTHONPATH="." py.test -n 2 \
--cov="." --cov-report=html --cov-report=term-missing \
--timeout=3600 --verbose --show-count -x \
test/registry/registry_tests.py
registry-test-old:
TEST=true PYTHONPATH="." py.test \
TEST=true PYTHONPATH="." py.test -n 2 \
--cov="." --cov-report=html --cov-report=term-missing \
--timeout=3600 --verbose --show-count -x \
./test/registry_tests.py

View file

@ -3,8 +3,12 @@
MODE="$1"
display_usage() {
echo "This script takes one argument."
echo -e "\nUsage: ${0} <shell|config|interactive|batch|both>\n"
echo "Usage: ${0} <shell|config|interactive|batch|both>"
echo
echo "If the first argument isn't one of the above modes,"
echo "the arguments will be exec'd directly, i.e.:"
echo
echo " ${0} uptime"
}
if [[ "${MODE}" = "help" ]]
@ -34,26 +38,30 @@ venv/bin/python -m displayversion
case "$MODE" in
"shell")
echo "Entering shell mode"
/bin/bash
exit 0
exec /bin/bash
;;
"config")
echo "Entering config mode, only copying config-app entrypoints"
cp -r ${QUAYDIR}/config_app/init/service/* /etc/service
exec /sbin/my_init
;;
"interactive")
echo "Copying $MODE files"
cp -r ${QUAYCONF}/init/service/interactive/* /etc/service
exec /sbin/my_init
;;
"batch")
echo "Copying $MODE files"
cp -r ${QUAYCONF}/init/service/batch/* /etc/service
exec /sbin/my_init
;;
*)
"")
echo "Copying all files"
cp -r ${QUAYCONF}/init/service/interactive/* /etc/service
cp -r ${QUAYCONF}/init/service/batch/* /etc/service
exec /sbin/my_init
;;
esac
/sbin/my_init
# Not a Quay mode, just exec the args.
exec "$@"

View file

@ -10,7 +10,7 @@ SHORT_SHA="${TRAVIS_COMMIT:0:7}"
IMAGE_TAG="${SHORT_SHA}-${TRAVIS_BUILD_NUMBER}"
IMAGE_TAR="${CACHE_DIR}/${IMAGE}-${IMAGE_TAG}.tar.gz"
MYSQL_IMAGE="mysql:5.6"
MYSQL_IMAGE="mysql:5.7"
POSTGRES_IMAGE="postgres:9.6"
export MYSQL_ROOT_PASSWORD="quay"
@ -43,9 +43,15 @@ clean_cache() {
rm "${IMAGE_TAR}"
}
fail_clean() {
if [[ $TRAVIS_TEST_RESULT -ne 0 ]]; then
echo "Job failed. Cleaning cache..."
clean_cache
fi
}
quay_run() {
docker run --net=host --entrypoint "/bin/bash" -e TEST_DATABASE_URI -ti "${IMAGE}:${IMAGE_TAG}" -c "$*"
docker run --net=host -e TEST_DATABASE_URI -ti "${IMAGE}:${IMAGE_TAG}" "$@"
}
@ -148,6 +154,10 @@ case "$1" in
postgres
;;
fail-clean)
fail_clean
;;
clean)
clean_cache
;;

View file

@ -71,7 +71,7 @@ def app_reloader(liveserver, server_executor):
yield
@pytest.mark.skipif(os.environ.get('TEST_DATABASE_URI'),
@pytest.mark.skipif(os.environ.get('TEST_DATABASE_URI') is not None,
reason="not supported for non SQLite testing")
def test_storage_proxy_auth(storage, liveserver_app, liveserver_session, is_proxying_enabled,
app_reloader):