diff --git a/.travis.yml b/.travis.yml index 169228c72..04043f651 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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: diff --git a/Dockerfile b/Dockerfile index b9f9074d5..32540a991 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] diff --git a/Makefile b/Makefile index 50f8109c7..d6f22188c 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/quay-entrypoint.sh b/quay-entrypoint.sh index 24c58b500..7401e511d 100755 --- a/quay-entrypoint.sh +++ b/quay-entrypoint.sh @@ -3,8 +3,12 @@ MODE="$1" display_usage() { - echo "This script takes one argument." - echo -e "\nUsage: ${0} \n" + echo "Usage: ${0} " + 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 \ No newline at end of file +# Not a Quay mode, just exec the args. +exec "$@" diff --git a/scripts/ci b/scripts/ci index 38b04afea..a5449d22a 100755 --- a/scripts/ci +++ b/scripts/ci @@ -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 ;; diff --git a/test/test_storageproxy.py b/test/test_storageproxy.py index b0a4577d4..026b11f62 100644 --- a/test/test_storageproxy.py +++ b/test/test_storageproxy.py @@ -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):