Use before_cache instead of after_failure to clean cache
This commit is contained in:
parent
23c01b40c5
commit
e2bde377d6
2 changed files with 12 additions and 2 deletions
|
@ -14,8 +14,8 @@ before_script:
|
||||||
- sudo service postgresql stop
|
- sudo service postgresql stop
|
||||||
|
|
||||||
# Clean the cache if any step fails.
|
# Clean the cache if any step fails.
|
||||||
after_failure:
|
before_cache:
|
||||||
- scripts/ci clean
|
- scripts/ci fail-clean
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
timeout: 1000
|
timeout: 1000
|
||||||
|
|
10
scripts/ci
10
scripts/ci
|
@ -43,6 +43,12 @@ 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 -e TEST_DATABASE_URI -ti "${IMAGE}:${IMAGE_TAG}" "$@"
|
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
|
||||||
;;
|
;;
|
||||||
|
|
Reference in a new issue