Skip to content

Commit

Permalink
Cleanup and delete old deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
lkiesow authored and github-actions[bot] committed Sep 2, 2024
1 parent 69f6dbe commit 1509ed9
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions cleanup-deployments.sh.51
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash



# That is list the files of type directory whose name does not contain
# a non-digit. So we only process automated deployments.
#
# Without LC_ALL=C, some find implementations, including GNU find could
# also list files whose name contains sequences of bytes that don't form
# valid characters in the current locale (like a répertoire encoded in
# iso8859-1 (mkdir $'r\xe9pertoire') in a locale that uses UTF-8 as charset).
DEPLOYMENTS=$(LC_ALL=C find . -maxdepth 1 ! -name '*[!0-9]*' -type d -printf '%p\n')


for instance in $DEPLOYMENTS
do
find "$instance" -maxdepth 1 -mindepth 1 -type d -printf '%p\n' | sort -g | head -n -3 | xargs rm -rf
done

0 comments on commit 1509ed9

Please sign in to comment.