[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] 2 commits: djm: various minor improvements

Holger Levsen (@holger) gitlab at salsa.debian.org
Mon Apr 3 15:27:22 BST 2023



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


Commits:
05d3c235 by Holger Levsen at 2023-04-03T16:16:52+02:00
djm: various minor improvements

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

- - - - -
e9cb00e8 by Holger Levsen at 2023-04-03T16:25:21+02:00
reproducible Arch Linux: cleanup leftovers in /tmp/archlinux-ci/ after 3 days

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

- - - - -


2 changed files:

- bin/djm
- bin/reproducible_maintenance.sh


Changes:

=====================================
bin/djm
=====================================
@@ -15,7 +15,7 @@ set -o pipefail		# see eg http://petereisentraut.blogspot.com/2010/11/pipefail.h
 # define environment and parse parameters
 #
 
-LOGFILE=~/.djm.log
+LOGFILE=~/.djm.log	# TODO: write a parser for this logfile to generate statistics
 TARGET=$1
 ACTION=$2
 REASON=$3
@@ -40,7 +40,7 @@ case $ACTION in
 	r|reboot)	ACTION=reboot ;;
 	p|powercycle)	ACTION=powercycle ;;
 	a|autoremove)	ACTION=autoremove ;;
-	b|bash)		ACTION=bash ;;
+	s|shell)	ACTION=shell ;;
 	*)		FAIL_REASON="${FAIL_REASON}Undefined action.\n"
 			;;
 esac
@@ -48,6 +48,7 @@ esac
 case $REASON in
 	ku)	REASON="kernel upgrade" ;;
 	np)	REASON="no ping" ;;
+	dj)	REASON="debug job problems" ;;
 	rm)	REASON="regular maintenance" ;;
 	*)		FAIL_REASON="${FAIL_REASON}Undefined reason.\n"
 			;;
@@ -68,8 +69,8 @@ if [ -n "$FAIL_REASON" ] ; then
 	echo problem parsing parameters, djm needs at least three:
 	echo
 	echo "TARGET=\$1	'all' or grepable (jenkins, amd64, ionos, osuosl3) from ./nodes/list_nodes"
-	echo "ACTION=\$2	r_eboot, _p_owercycle, _a_utoremove, _b_bash (for manual maintenance)"
-	echo "REASON=\$3	ku=kernel update, np=no pings, rm=regular maintenance - TODO: define more"
+	echo "ACTION=\$2	r_eboot, _p_owercycle, _a_utoremove, _s_shell (for manual maintenance)"
+	echo "REASON=\$3	ku=kernel update, np=no pings, dj=debug job problems, rm=regular maintenance - TODO: define more"
 	echo "DRY_RUN=\$4	optional to force dry-run mode"
 	echo
 	echo params given:
@@ -143,7 +144,7 @@ for NODE in $TARGET ; do
 	# action
 	#
 	case $ACTION in
-		reboot)	ssh $NODE "sudo reboot" || true
+		reboot)	ssh $NODE "sudo reboot || read enter" || true
 			TMPFILE=$(mktemp --tmpdir=/tmp djm-XXXXXXXX)
 			cat > $TMPFILE << EOF
 #!/bin/bash
@@ -166,9 +167,9 @@ EOF
 		powercycle)	echo FIXME, not yet implemented.
 				exit 1
 				;;
-		autoremove)	xterm -T "$SHORTNODE / autoremove" -class deploy-jenkins -bg $BG -fa 'DejaVuSansMono' -fs 10 -e "ssh $NODE 'sudo apt-get autoremove ; sudo apt-get clean'" &
+		autoremove)	xterm -T "$SHORTNODE / autoremove" -class deploy-jenkins -bg $BG -fa 'DejaVuSansMono' -fs 10 -e "ssh $NODE 'sudo apt-get autoremove || read enter; sudo apt-get clean || read enter'" &
 			;;
-		bash)	xterm -T "$SHORTNODE / bash" -class deploy-jenkins -bg $BG -fa 'DejaVuSansMono' -fs 10 -e "ssh $NODE" &
+		shell)	xterm -T "$SHORTNODE / shell" -class deploy-jenkins -bg $BG -fa 'DejaVuSansMono' -fs 10 -e "ssh $NODE" &
 			;;
 		*)	echo unsupported action, sorry, please improve.
 			exit 1
@@ -181,4 +182,4 @@ EOF
 	echo "$LOGDATE, $SHORTNODE, $ACTION, $REASON" >> $LOGFILE
 done
 
-echo the end
+echo Thank you for doing documented jenkins maintenance.


=====================================
bin/reproducible_maintenance.sh
=====================================
@@ -73,6 +73,21 @@ if [ -n "$OLDSTUFF" ] ; then
 	DIRTY=true
 fi
 
+#
+# delete leftovers in /tmp/archlinux-ci/
+#
+echo "$(date -u) - Deleting leftovers in /tmp/archlinux-ci/, older than 3 days."
+OLDSTUFF=$(find /tmp/archlinux-ci/* -maxdepth 0 -mtime +2 -exec ls -lad {} \; || true)
+if [ -n "$OLDSTUFF" ] ; then
+	echo
+	echo "Leftovers found in /tmp/archlinux-ci/"
+	find /tmp/archlinux-ci/* -maxdepth 0 -mtime +2 -exec sudo rm -rf --one-file-system {} \; || true
+	echo "These old leftovers have been deleted."
+	echo
+	DIRTY=true
+fi
+
+
 #
 # delete old pbuilder build directories
 #



View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/compare/f1733a4bad70f0c82b53971ff3a8de24f4be03d4...e9cb00e87ae09533a6b9eefbcb9025d36cad415e

-- 
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/compare/f1733a4bad70f0c82b53971ff3a8de24f4be03d4...e9cb00e87ae09533a6b9eefbcb9025d36cad415e
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/20230403/4ce177f5/attachment-0001.htm>


More information about the Qa-jenkins-scm mailing list