diff --git a/jenkins/scripts/slave-cleanup.sh b/jenkins/scripts/slave-cleanup.sh index e31f14d951..0f0cc3fa2f 100644 --- a/jenkins/scripts/slave-cleanup.sh +++ b/jenkins/scripts/slave-cleanup.sh @@ -1,25 +1,11 @@ #!/bin/bash -xe -# Delete some files on slave at most once a day. -# Stores a marker file with date of last deletion. +# Cleanup workspace afterwards so that no extra files are in it. +# This is also done at beginning of each job but let's do it +# afterwards to save space on the workspace between invocations. -MARKER=.marker_CREATED - -if [[ -f $MARKER ]] ; then - - TODAY=$(date '+%Y%m%d') - # Delete only once a day - if [[ $(date -f $MARKER '+%Y%m%d') != $TODAY ]] ; then - # Let's see how much we delete. - # Let du report sizes each directory. - du -h --max-depth=1 . - git clean -f -x -d - du -h --max-depth=1 . - fi -fi - -# Create marker file if it does not exist. - -if [[ ! -f $MARKER ]] ; then - date '+%Y%m%d' > $MARKER -fi +# Let's see how much we delete. +# Let du report sizes each directory. +du -h --max-depth=1 . +git clean -f -x -d +du -h --max-depth=1 .