[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] refactor and reduce redundant output to make it more readable
Holger Levsen (@holger)
gitlab at salsa.debian.org
Mon Jun 21 23:14:30 BST 2021
Holger Levsen pushed to branch master at Debian QA / jenkins.debian.net
Commits:
bfc328d4 by Holger Levsen at 2021-06-22T00:13:22+02:00
refactor and reduce redundant output to make it more readable
Signed-off-by: Holger Levsen <holger at layer-acht.org>
- - - - -
1 changed file:
- bin/reproducible_maintenance.sh
Changes:
=====================================
bin/reproducible_maintenance.sh
=====================================
@@ -361,18 +361,19 @@ esac
set -e
# delete build services logfiles
+dir=/var/lib/jenkins/userContent/reproducible/debian/build_service/
if [ "$HOSTNAME" = "$MAINNODE" ] ; then
- if [ -d /var/lib/jenkins/userContent/reproducible/debian/build_service/ ] ; then
+ if [ -d $dir ] ; then
echo "$(date -u) - Deleting logfiles from build services directories, older than a day."
- OLDSTUFF=$(find /var/lib/jenkins/userContent/reproducible/debian/build_service/ -maxdepth 2 -regex '.*/[0-9]+' -type d -mtime +0 -exec ls -lad {} \; || true)
+ OLDSTUFF=$(find $dir -maxdepth 2 -regex '.*/[0-9]+' -type d -mtime +0 -exec ls -lad {} \; || true)
if [ ! -z "$OLDSTUFF" ] ; then
echo
- echo "Old logfiles cleaned in /var/lib/jenkins/userContent/reproducible/debian/build_service/"
- echo -n "$OLDSTUFF"
+ echo "Old logfiles cleaned in $dir"
+ echo -n "$OLDSTUFF" | sed 's#$dir#./#g'
# we make sure to actually only delete console.log.gz older than a day
# other stuff we only delete after two days (in case a build is running more than 24h...)
- find /var/lib/jenkins/userContent/reproducible/debian/build_service/ -maxdepth 2 -regex '.*/[0-9]+' -type d -mtime +0 -name console.log.gz -exec rm -rf --one-file-system {} \; || true
- find /var/lib/jenkins/userContent/reproducible/debian/build_service/ -maxdepth 2 -regex '.*/[0-9]+' -type d -mtime +1 -exec rm -rf --one-file-system {} \; || true
+ find $dir -maxdepth 2 -regex '.*/[0-9]+' -type d -mtime +0 -name console.log.gz -exec rm -rf --one-file-system {} \; || true
+ find $dir -maxdepth 2 -regex '.*/[0-9]+' -type d -mtime +1 -exec rm -rf --one-file-system {} \; || true
echo
fi
fi
@@ -418,14 +419,15 @@ if [ "$HOSTNAME" = "$MAINNODE" ] ; then
if [ ! -z "$OLDSTUFF" ]; then
echo
echo "data in $dir older than 2 days found, which will be deleted:"
- echo "$OLDSTUFF"
+ echo "$OLDSTUFF" | sed 's#$dir#./#g'
+
echo
find "$dir" -name "jenkins-reproducible-*-diffoscope-*" -mindepth 1 -maxdepth 1 -type $FILETYPE -mtime +1 -exec sudo $RM -v {} \; || true
OLDSTUFF=$(find "$dir" -name "jenkins-reproducible-*-diffoscope-*" -mindepth 1 -maxdepth 1 -type $FILETYPE -mtime +1 -exec ls -lad {} \; || true)
if [ ! -z "$OLDSTUFF" ]; then
echo
echo "Warning: Tried, but failed to delete these in $dir:"
- echo "$OLDSTUFF"
+ echo "$OLDSTUFF" | sed 's#$dir#./#g'
echo "Manual cleanup needed."
fi
echo
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/bfc328d4ca8ce8c470b2a34823ea9391cd50d5db
--
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/bfc328d4ca8ce8c470b2a34823ea9391cd50d5db
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/qa-jenkins-scm/attachments/20210621/e67d1d95/attachment-0001.htm>
More information about the Qa-jenkins-scm
mailing list