[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] teach deploy_jdn about djm logging, before we merge deploy_jdn into djm

Holger Levsen (@holger) gitlab at salsa.debian.org
Sun Apr 9 16:12:10 BST 2023



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


Commits:
dc10f29d by Holger Levsen at 2023-04-09T17:11:57+02:00
teach deploy_jdn about djm logging, before we merge deploy_jdn into djm

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

- - - - -


2 changed files:

- bin/djm-logparser
- deploy_jdn


Changes:

=====================================
bin/djm-logparser
=====================================
@@ -35,9 +35,9 @@ TWENTY_MIN_SLICES=$(( TEN_MIN_SLICES + TEN_MIN_SLICES ))
 SLICES_AS_HOURS=$(($TWENTY_MIN_SLICES/3))
 # create sorted list of actions/reasons (sorted by amount of occurances)
 #  the character '%" is solely used as a delimeter for cut later
-#  the character '_' is added so later we can use a for-loop without dealing with $IFS
-ACTIONS=$(cut -d ',' -f3 $LOGFILE | sort | sed 's#^#%#g'| uniq -c | sort -nr | cut -d '%' -f2| sed -s "s# #_#g")
-REASONS=$(cut -d ',' -f4 $LOGFILE | sort | sed 's#^#%#g'| uniq -c | sort -nr | cut -d '%' -f2| sed -s "s# #_#g")
+#  the character '=' is added so later we can use a for-loop without dealing with $IFS
+ACTIONS=$(cut -d ',' -f3 $LOGFILE | sort | sed 's#^#%#g'| uniq -c | sort -nr | cut -d '%' -f2| sed -s "s# #=#g")
+REASONS=$(cut -d ',' -f4 $LOGFILE | sort | sed 's#^#%#g'| uniq -c | sort -nr | cut -d '%' -f2| sed -s "s# #=#g")
 
 echo "Still very simple statistics for djm logs at $LOGFILE in $LOGMONTH"
 echo
@@ -56,7 +56,7 @@ printf "$TWO_C" " thoses slices as hours:" "${SLICES_AS_HOURS}h"
 seperator
 
 for action in $ACTIONS ; do
-	grep_action="$(echo $action | sed -s 's#_# #g' | xargs echo)"
+	grep_action="$(echo $action | sed -s 's#=# #g' | xargs echo)"
 	AMOUNT=$(cut -d ',' -f3 $LOGFILE |grep "$grep_action"|wc -l)
 	PERCENT=$((200*$AMOUNT/$TOTAL % 2 + 100*$AMOUNT/$TOTAL))
 	printf "$THREE_C" "$grep_action actions:" "$PERCENT%" "($AMOUNT / $TOTAL)"
@@ -64,7 +64,7 @@ done
 seperator
 
 for reason in $REASONS ; do
-	grep_reason="$(echo $reason | sed -s 's#_# #g' | xargs echo)"
+	grep_reason="$(echo $reason | sed -s 's#=# #g' | xargs echo)"
 	AMOUNT=$(cut -d ',' -f4 $LOGFILE |grep "$grep_reason"|wc -l)
 	PERCENT=$((200*$AMOUNT/$TOTAL % 2 + 100*$AMOUNT/$TOTAL))
 	printf "$THREE_C" "$grep_reason reasons:" "$PERCENT%" "($AMOUNT / $TOTAL)"


=====================================
deploy_jdn
=====================================
@@ -46,6 +46,9 @@ EOF
 }
 
 
+LOGFILE=~/.djm.log
+LOGDATE="$(date -u '+%Y-%m-%d %H:%M UTC')"
+
 START=$(date +'%s')
 GIT_REPO="https://salsa.debian.org/qa/jenkins.debian.net.git"
 mapfile -t HOSTS < <(nodes/list_nodes | grep -v jenkins.debian.net)
@@ -87,6 +90,7 @@ if [ "$1" = "fixme" ] ; then
 	show_fixmes
 	exit 0
 elif [ "$1" = "all" ] ; then
+	ACTION="deploy jdn.git"
 	echo -n "Running j.d.n.git updates on ${HOSTS[@]} now"
 	# reset_clock can be false as update_jdn.sh sets the time
 	reset_clock=false
@@ -97,23 +101,24 @@ elif [ "$1" = "all" ] ; then
 		real_command="$@ && echo '__reallyreally=ok__'"
 	fi
 elif [ "$1" = "upgrade" ] || [ "$1" = "u" ] ; then
+	ACTION="apt upgrade"
 	real_command="export LANG=C && sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade && sudo apt-get clean"
 	shift
 elif [ "$1" = "upgradey" ] || [ "$1" = "uy" ] ; then
+	ACTION="apt upgrade"
 	real_command="export LANG=C && sudo apt-get update && sudo apt-get -y upgrade && sudo apt-get -y dist-upgrade && sudo apt-get clean"
 	shift
 elif [ "$1" = "rmstamp" ] || [ "$1" = "rm" ] ; then
+	ACTION="rm stamp"
 	real_command="sudo rm -f /var/log/jenkins/*stamp && echo '__reallyreally=ok__'"
 	reset_clock=false
 	shift
-elif [ "$1" = "check" ] ; then
-	real_command="pgrep -l -a -f _build.sh"
-	reset_clock=false
-	shift
 elif [ "$1" = "" ] ; then
+	ACTION="deploy jdn.git"
 	HOSTS=(root at jenkins.debian.net)
 	echo -n "Running j.d.n.git updates on ${HOSTS[@]} now"
 elif [ "$1" = "jenkins" ] || [ "$1" = "only" ] ; then
+	ACTION="deploy jdn.git"
 	if [ "$1" = "jenkins" ] ; then
 		HOSTS=(root at jenkins.debian.net)
 	else
@@ -216,6 +221,9 @@ for i in "${HOSTS[@]}" ; do
 		fi
 	fi
 	get_arch_color $i
+	# djm logging
+	SHORTNODE=$(echo $i | sed 's#root@##g'|cut -d '.' -f1 )
+	echo "$LOGDATE, $SHORTNODE, $ACTION, regular maintenance" >> $LOGFILE
 	xterm -class deploy-jenkins -bg $BG -fa 'DejaVuSansMono' -fs 10 -e "ssh -o 'BatchMode = yes' -t $i '$remote_command' | tee $LOG.$i ; sleep 2 ; touch $LOG.$i.done" &
 	unset GITOPTS
 done



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

-- 
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/dc10f29db13137ccac3cf6ee3680cd50485b11ea
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/20230409/614b9aa7/attachment-0001.htm>


More information about the Qa-jenkins-scm mailing list