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
|
||||
|
||||
# Clean the cache if any step fails.
|
||||
after_failure:
|
||||
- scripts/ci clean
|
||||
before_cache:
|
||||
- scripts/ci fail-clean
|
||||
|
||||
cache:
|
||||
timeout: 1000
|
||||
|
|
10
scripts/ci
10
scripts/ci
|
@ -43,6 +43,12 @@ 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 -e TEST_DATABASE_URI -ti "${IMAGE}:${IMAGE_TAG}" "$@"
|
||||
|
@ -148,6 +154,10 @@ case "$1" in
|
|||
postgres
|
||||
;;
|
||||
|
||||
fail-clean)
|
||||
fail_clean
|
||||
;;
|
||||
|
||||
clean)
|
||||
clean_cache
|
||||
;;
|
||||
|
|
Reference in a new issue