[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] maintenance: cleanup sbuild dirs using sudo and after 3 days already

Holger Levsen gitlab at salsa.debian.org
Mon May 3 14:05:33 BST 2021



Holger Levsen pushed to branch master at Debian QA / jenkins.debian.net


Commits:
5f5ca777 by Holger Levsen at 2021-05-03T15:05:18+02:00
maintenance: cleanup sbuild dirs using sudo and after 3 days already

Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -


4 changed files:

- bin/reproducible_maintenance.sh
- hosts/common/etc/sudoers.d/jenkins
- hosts/ionos10-amd64/etc/sudoers.d/jenkins
- hosts/jenkins/etc/sudoers.d/jenkins


Changes:

=====================================
bin/reproducible_maintenance.sh
=====================================
@@ -396,7 +396,7 @@ if [ ! -z "$OLDSTUFF" ]; then
 		echo
 		echo "Warning: Tried, but failed to delete these schroot sessions:"
 		echo "$OLDSTUFF"
-		echo "Manual cleanup needed"
+		echo "Manual cleanup needed."
 	fi
 	echo
 	DIRTY=true
@@ -426,7 +426,7 @@ if [ "$HOSTNAME" = "$MAINNODE" ] ; then
 				echo
 				echo "Warning: Tried, but failed to delete these in $dir:"
 				echo "$OLDSTUFF"
-				echo "Manual cleanup needed"
+				echo "Manual cleanup needed."
 			fi
 			echo
 			DIRTY=true
@@ -457,7 +457,7 @@ cleanup_old_schroots() {
 			echo
 			echo "Warning: Tried, but failed to delete these $OBJECTS:"
 			echo "$OLDSTUFF"
-			echo "Manual cleanup needed!"
+			echo "Manual cleanup needed."
 		fi
 		echo
 		DIRTY=true
@@ -475,7 +475,7 @@ if [ ! -z "$OLDSTUFF" ]; then
 	echo "Warning: schroots older than 1 month found in /schroot:"
 	echo "$OLDSTUFF"
 	echo
-	echo "Manual cleanup needed!"
+	echo "Manual cleanup needed."
 	echo
 	DIRTY=true
 fi
@@ -483,20 +483,21 @@ fi
 # remove too old sbuild directories
 dir=/var/lib/sbuild/build
 if [ -d $dir ] ; then
-	echo "$(date -u) - Removing sbuild directories older than 7 days."
+	echo "$(date -u) - Removing sbuild directories older than 3 days."
 	OLDSTUFF=$(find "$dir" -mindepth 1 -maxdepth 1 -type d -mtime +6 -exec ls -lad {} \;)
 	if [ ! -z "$OLDSTUFF" ]; then
 		echo
-		echo "sbuild directories older than 7 days found, which will be deleted:"
+		echo "sbuild directories older than 3 days found, which will be deleted:"
 		echo "$OLDSTUFF"
 		echo
-		find "$dir" -mindepth 1 -maxdepth 1 -type d -mtime +6 -exec rm -r {} \;
-		OLDSTUFF=$(find "$dir" -mindepth 1 -maxdepth 1 -type d -mtime +6 -exec ls -lad {} \;)
+		find "$dir" -mindepth 1 -maxdepth 1 -type d -mtime +2 -exec sudo rm -rf --one-file-system {} \;
+		OLDSTUFF=$(find "$dir" -mindepth 1 -maxdepth 1 -type d -mtime +2 -exec ls -lad {} \;)
 		if [ ! -z "$OLDSTUFF" ]; then
 			echo
 			echo "Warning: Tried, but failed to delete these sbuild directories:"
 			echo "$OLDSTUFF"
-			echo "Manual cleanup needed"
+			echo
+			echo "Manual cleanup needed."
 		fi
 		echo
 		DIRTY=true


=====================================
hosts/common/etc/sudoers.d/jenkins
=====================================
@@ -22,6 +22,7 @@ jenkins ALL=  \
 	/bin/rm -rf --one-file-system /chroots/*, \
 	/bin/rm -rf --one-file-system /schroots/*, \
 	/bin/rm -rf --one-file-system /srv/workspace/pbuilder/*, \
+	/bin/rm -rf --one-file-system /var/lib/sbuild/build/*, \
 	/bin/rm -rf --one-file-system /tmp/*, \
 	/bin/rm -rv --one-file-system /tmp/*, \
 	/bin/mv /chroots/* /schroots/*, \


=====================================
hosts/ionos10-amd64/etc/sudoers.d/jenkins
=====================================
@@ -18,6 +18,7 @@ jenkins ALL=  \
 	/bin/rm -rf --one-file-system /schroots/*, \
 	/bin/rm -rf --one-file-system /srv/workspace/pbuilder/*, \
 	/bin/rm -rf --one-file-system /srv/workspace/chroots/*, \
+	/bin/rm -rf --one-file-system /var/lib/sbuild/build/*, \
 	/bin/mv /chroots/* /schroots/*, \
 	/bin/mv /schroots/* /schroots/*, \
 	/bin/umount -l /chroots/*, \


=====================================
hosts/jenkins/etc/sudoers.d/jenkins
=====================================
@@ -20,6 +20,7 @@ jenkins ALL=  \
 	/bin/rm -rf --one-file-system /chroots/*, \
 	/bin/rm -rf --one-file-system /schroots/*, \
 	/bin/rm -rf --one-file-system /srv/workspace/pbuilder/*, \
+	/bin/rm -rf --one-file-system /var/lib/sbuild/build/*, \
 	/bin/rm -rf --one-file-system /tmp/*, \
 	/bin/rm -rv --one-file-system /tmp/*, \
 	/bin/rm -v /var/lib/schroot/*, \



View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/5f5ca777d81e79de8717b72941f1255787cfea00

-- 
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/5f5ca777d81e79de8717b72941f1255787cfea00
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/20210503/a60f944b/attachment-0001.htm>


More information about the Qa-jenkins-scm mailing list