[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] djm: new action: apt-upgrade

Holger Levsen (@holger) gitlab at salsa.debian.org
Tue May 16 15:15:29 BST 2023



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


Commits:
1b96205a by Holger Levsen at 2023-05-16T16:15:14+02:00
djm: new action: apt-upgrade

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

- - - - -


2 changed files:

- TODO
- bin/djm


Changes:

=====================================
TODO
=====================================
@@ -32,24 +32,20 @@ See link:https://jenkins.debian.net/userContent/about.html["about jenkins.debian
 ** maybe: rm /tmp/mmdebstrap.* older than 3 days
 * split TODO in TODO and TODO.legacy?
 * djm:
+** ACTION: deploy git
+** ACTION: rmstamp
+** ACTION: c (or rc) - run arbitrary command (with and without reset_clock)
+** then get rid of deploy_jdn
 ** also log an id, so that one command effecting several hosts is counted as on action
-** ACTION: c (or rc) - run command
-*** support: ./deploy_jdn all 'sudo apt autoremove ; sudo apt clean'
-** get rif of deploy_jdn
-*** and while at it, make actions triggering 'all' be only one entry in the djm logfile -> more sensible stats
-** cleanup/backup logs on the first of the month
-** document running "mosh jenkins shell-monitor" processes :) (same with my_btop to be renamed and git added...)
-** create osuosl tickets?
-** document jenkins plugin updates -> manually / though my local script which calls the webpages can log this
-** document other jenkins ui actions. are there any?
-* djm-logparser:
+*** make actions triggering 'all' be only one entry in the djm logfile -> more sensible stats
+** automatically backup+cleanup logs on the first of the month
 ** new feature: --show-month 04
 ** include hours with manual jobs triggered
-** include notmuch mails, "received and read". write djm-notmuch-parser.
-** include irc. (timeslices when one said something on relevant channels)
-** include amount of job runs on jenkins
-* djm-fetch-logs
-** backup+cleanup logs on the first of the month, also automatically
+** maybe:
+*** document running "mosh jenkins shell-monitor" processes?
+*** document jenkins plugin updates -> manually or though my local script which calls the webpages could log this more easily
+*** include notmuch mails, "received and read". write djm-notmuch-parser.
+*** include irc. (timeslices when one said something on relevant channels)
 
 === nodes at OSUOSL
 


=====================================
bin/djm
=====================================
@@ -118,9 +118,9 @@ show_help(){
 	echo "TARGET=	'all' or grepable (jenkins, amd64, ionos, osuosl3) from ./nodes/list_nodes"
 	echo "         	or special target '.'"
 	echo "ACTION=	r_eboot, _p_owercycle, _a_utoremove, _s_shell (for manual maintenance),"
-	echo "         	_j_enkins-ui, _b_ring-back or _f_fix-future."
+	echo "         	_j_enkins-ui, _b_ring-back, _f_fix-future or _u_pgrade."
 	echo "REASON=	ku=kernel update, np=no pings, dj=debug job problems, rm=regular maintenance,"
-	echo "         	cs=clock skew, hb=host back, ho=host overloaded, nt=new things"
+	echo "         	cs=clock skew, hb=host back, ho=host overloaded, nt=new things, su=security updates"
 	echo
 	echo params given:
 	echo
@@ -160,6 +160,7 @@ verify_target_action_reason(){
 		j|jenkins-ui)	ACTION=jenkins-ui ;;
 		b|bring-back)	ACTION=bring-back ;;
 		f|fix-future)	ACTION=fix-future ;;
+		u|upgrade)	ACTION=apt-upgrade ;;
 		*)		FAIL_REASON="${FAIL_REASON}Undefined action.\n"
 				;;
 	esac
@@ -172,6 +173,7 @@ verify_target_action_reason(){
 		hb)	REASON="host is back" ;;
 		ho)	REASON="host is overloaded" ;;
 		nt)	REASON="new things" ;;
+		su)	REASON="security updates" ;;
 		*)	FAIL_REASON="${FAIL_REASON}Undefined reason.\n"
 				;;
 	esac
@@ -416,7 +418,12 @@ djm_do() {
 			SHORTNODE="jenkins web UI"
 		fi
 		echo "$(date -u '+%Y-%m-%d %H:%M UTC'), $SHORTNODE, $ACTION, $REASON"
+		# node specific configuration
 		get_arch_color $NODE
+		case $SHORTNODE in
+			osuosl*)	NTP_SERVER=time.osuosl.org ;;
+			*)		NTP_SERVER=de.pool.ntp.org ;;
+		esac
 		#
 		# action
 		#
@@ -459,11 +466,7 @@ djm_do() {
 					echo "Trying to mark $SHORTNODE as online. This is the diff for $OFF_NODES on jenkins.debian.net:"
 					ssh jenkins.debian.net "grep -v $SHORTNODE $OFF_NODES > $TMPFILE ; diff $OFF_NODES $TMPFILE ; mv $TMPFILE $OFF_NODES ; chown jenkins:jenkins $OFF_NODES"
 					;;
-			fix-future)	case $SHORTNODE in
-						osuosl*)	NTP_SERVER=time.osuosl.org ;;
-						*)		NTP_SERVER=de.pool.ntp.org ;;
-					esac
-					COMMAND="date ; sudo ntpdate -b $NTP_SERVER"
+			fix-future)	COMMAND="date ; sudo ntpdate -b $NTP_SERVER"
 					if node_in_the_future "$SHORTNODE" ; then
 						COMMAND="$COMMAND && sudo date --set='+398 days +6 hours + 23 minutes'"
 						COMMAND="$COMMAND ; date -u ; echo press enter ; read a"
@@ -473,6 +476,13 @@ djm_do() {
 						continue
 					fi
 
+					;;
+			apt-upgrade)	COMMAND="sudo apt-get update && sudo apt-get -y dist-upgrade && sudo apt-get clean"
+					if node_in_the_future "$SHORTNODE" ; then
+						COMMAND="sudo ntpdate -b $NTP_SERVER ; $COMMAND ; sudo date --set='+398 days +6 hours + 23 minutes'"
+					fi
+					COMMAND="( $COMMAND ) || ( echo press enter ; read a ) ; echo 'sleeping 10s now' ; sleep 10"
+					xterm -T "$SHORTNODE / $ACTION" -class deploy-jenkins -bg $BG -fa 'DejaVuSansMono' -fs 10 -e "ssh -t $NODE \"$COMMAND\"" &
 					;;
 			*)	echo unsupported action, sorry, please improve.
 				exit 1



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

-- 
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/1b96205a54d67ecc9c3c079aca656c902bb581e5
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/20230516/d0aa3df8/attachment-0001.htm>


More information about the Qa-jenkins-scm mailing list