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 mysql stop
- sudo service postgresql stop - sudo service postgresql stop
# Clean the cache if any step fails.
before_cache:
- scripts/ci fail-clean
cache: cache:
timeout: 1000 timeout: 1000
directories: directories:

View file

@ -142,4 +142,4 @@ RUN ./scripts/detect-config.sh
EXPOSE 443 8443 80 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 ln -s $(QUAY_CONFIG)/local/license conf/stack/license
unit-test: unit-test:
TEST=true PYTHONPATH="." py.test \ TEST=true PYTHONPATH="." py.test -n 2 \
--cov="." --cov-report=html --cov-report=term-missing \ --cov="." --cov-report=html --cov-report=term-missing \
--timeout=3600 --verbose -x \ --timeout=3600 --verbose -x \
./ ./
registry-test: registry-test:
TEST=true PYTHONPATH="." py.test \ TEST=true PYTHONPATH="." py.test -n 2 \
--cov="." --cov-report=html --cov-report=term-missing \ --cov="." --cov-report=html --cov-report=term-missing \
--timeout=3600 --verbose --show-count -x \ --timeout=3600 --verbose --show-count -x \
test/registry/registry_tests.py test/registry/registry_tests.py
registry-test-old: registry-test-old:
TEST=true PYTHONPATH="." py.test \ TEST=true PYTHONPATH="." py.test -n 2 \
--cov="." --cov-report=html --cov-report=term-missing \ --cov="." --cov-report=html --cov-report=term-missing \
--timeout=3600 --verbose --show-count -x \ --timeout=3600 --verbose --show-count -x \
./test/registry_tests.py ./test/registry_tests.py

View file

@ -3,8 +3,12 @@
MODE="$1" MODE="$1"
display_usage() { display_usage() {
echo "This script takes one argument." echo "Usage: ${0} <shell|config|interactive|batch|both>"
echo -e "\nUsage: ${0} <shell|config|interactive|batch|both>\n" 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" ]] if [[ "${MODE}" = "help" ]]
@ -34,26 +38,30 @@ venv/bin/python -m displayversion
case "$MODE" in case "$MODE" in
"shell") "shell")
echo "Entering shell mode" echo "Entering shell mode"
/bin/bash exec /bin/bash
exit 0
;; ;;
"config") "config")
echo "Entering config mode, only copying config-app entrypoints" echo "Entering config mode, only copying config-app entrypoints"
cp -r ${QUAYDIR}/config_app/init/service/* /etc/service cp -r ${QUAYDIR}/config_app/init/service/* /etc/service
exec /sbin/my_init
;; ;;
"interactive") "interactive")
echo "Copying $MODE files" echo "Copying $MODE files"
cp -r ${QUAYCONF}/init/service/interactive/* /etc/service cp -r ${QUAYCONF}/init/service/interactive/* /etc/service
exec /sbin/my_init
;; ;;
"batch") "batch")
echo "Copying $MODE files" echo "Copying $MODE files"
cp -r ${QUAYCONF}/init/service/batch/* /etc/service cp -r ${QUAYCONF}/init/service/batch/* /etc/service
exec /sbin/my_init
;; ;;
*) "")
echo "Copying all files" echo "Copying all files"
cp -r ${QUAYCONF}/init/service/interactive/* /etc/service cp -r ${QUAYCONF}/init/service/interactive/* /etc/service
cp -r ${QUAYCONF}/init/service/batch/* /etc/service cp -r ${QUAYCONF}/init/service/batch/* /etc/service
exec /sbin/my_init
;; ;;
esac 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_TAG="${SHORT_SHA}-${TRAVIS_BUILD_NUMBER}"
IMAGE_TAR="${CACHE_DIR}/${IMAGE}-${IMAGE_TAG}.tar.gz" IMAGE_TAR="${CACHE_DIR}/${IMAGE}-${IMAGE_TAG}.tar.gz"
MYSQL_IMAGE="mysql:5.6" MYSQL_IMAGE="mysql:5.7"
POSTGRES_IMAGE="postgres:9.6" POSTGRES_IMAGE="postgres:9.6"
export MYSQL_ROOT_PASSWORD="quay" export MYSQL_ROOT_PASSWORD="quay"
@ -43,9 +43,15 @@ clean_cache() {
rm "${IMAGE_TAR}" rm "${IMAGE_TAR}"
} }
fail_clean() {
if [[ $TRAVIS_TEST_RESULT -ne 0 ]]; then
echo "Job failed. Cleaning cache..."
clean_cache
fi
}
quay_run() { 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 postgres
;; ;;
fail-clean)
fail_clean
;;
clean) clean)
clean_cache clean_cache
;; ;;

View file

@ -71,7 +71,7 @@ def app_reloader(liveserver, server_executor):
yield 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") reason="not supported for non SQLite testing")
def test_storage_proxy_auth(storage, liveserver_app, liveserver_session, is_proxying_enabled, def test_storage_proxy_auth(storage, liveserver_app, liveserver_session, is_proxying_enabled,
app_reloader): app_reloader):