Merge "Rework slave-cleanup"
This commit is contained in:
@@ -1,25 +1,11 @@
|
|||||||
#!/bin/bash -xe
|
#!/bin/bash -xe
|
||||||
|
|
||||||
# Delete some files on slave at most once a day.
|
# Cleanup workspace afterwards so that no extra files are in it.
|
||||||
# Stores a marker file with date of last deletion.
|
# 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
|
# Let's see how much we delete.
|
||||||
|
# Let du report sizes each directory.
|
||||||
if [[ -f $MARKER ]] ; then
|
du -h --max-depth=1 .
|
||||||
|
git clean -f -x -d
|
||||||
TODAY=$(date '+%Y%m%d')
|
du -h --max-depth=1 .
|
||||||
# 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
|
|
||||||
|
Reference in New Issue
Block a user