[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] 2 commits: reproducible maintenance: delete old schroot sessions after 2 days, not 3

Holger Levsen gitlab at salsa.debian.org
Mon Sep 7 07:48:22 BST 2020



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


Commits:
942da423 by Holger Levsen at 2020-09-07T08:47:41+02:00
reproducible maintenance: delete old schroot sessions after 2 days, not 3

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

- - - - -
802b2e19 by Holger Levsen at 2020-09-07T08:47:41+02:00
reproducible maintenance: refactoring

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

- - - - -


1 changed file:

- bin/reproducible_maintenance.sh


Changes:

=====================================
bin/reproducible_maintenance.sh
=====================================
@@ -417,29 +417,24 @@ fi
 
 # remove too old schroot session data from diffoscope
 if [ "$HOSTNAME" = "$MAINNODE" ] ; then
-	echo "$(date -u) - Removing diffoscope schroot session data older than 3 days."
+	echo "$(date -u) - Removing diffoscope schroot session data older than 2 days."
 	for path in session union/underlay union/overlay ; do
 		dir=/var/lib/schroot/$path/
 		if [ "$path" = "session" ] ; then
-			OLDSTUFF=$(find "$dir" -name "jenkins-reproducible-*-diffoscope-*" -mindepth 1 -maxdepth 1 -type f -mtime +2 -exec ls -lad {} \; || true)
+			FILETYPE=f
+			RM=rm
 		else
-			OLDSTUFF=$(find "$dir" -name "jenkins-reproducible-*-diffoscope-*" -mindepth 1 -maxdepth 1 -type d -mtime +2 -exec ls -lad {} \; || true)
+			FILETYPE=d
+			RM=rmdir
 		fi
+		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 "data in $dir older than 3 days found, which will be deleted:"
+			echo "data in $dir older than 2 days found, which will be deleted:"
 			echo "$OLDSTUFF"
 			echo
-			if [ "$path" = "session" ] ; then
-				find "$dir" -name "jenkins-reproducible-*-diffoscope-*" -mindepth 1 -maxdepth 1 -type f -mtime +2 -exec sudo rm -v {} \; || true
-			else
-				find "$dir" -name "jenkins-reproducible-*-diffoscope-*" -mindepth 1 -maxdepth 1 -type d -mtime +2 -exec sudo rmdir -v {} \; || true
-			fi
-			if [ "$path" = "session" ] ; then
-				OLDSTUFF=$(find "$dir" -name "jenkins-reproducible-*-diffoscope-*" -mindepth 1 -maxdepth 1 -type f -mtime +2 -exec ls -lad {} \; || true)
-			else
-				OLDSTUFF=$(find "$dir" -name "jenkins-reproducible-*-diffoscope-*" -mindepth 1 -maxdepth 1 -type d -mtime +2 -exec ls -lad {} \; || true)
-			fi
+			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:"



View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/compare/5b07571c7e62d70289dc99577e4691e44e1dd745...802b2e190c0d1b9537f052fd35a989cc63f4409e

-- 
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/compare/5b07571c7e62d70289dc99577e4691e44e1dd745...802b2e190c0d1b9537f052fd35a989cc63f4409e
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/20200907/07f59e88/attachment-0001.html>


More information about the Qa-jenkins-scm mailing list