[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] 2 commits: reproducible trbo system health check: refactoring

Holger Levsen gitlab at salsa.debian.org
Mon Jul 27 12:22:28 BST 2020



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


Commits:
2edf5937 by Holger Levsen at 2020-07-27T13:18:34+02:00
reproducible trbo system health check: refactoring

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

- - - - -
612bc046 by Holger Levsen at 2020-07-27T13:22:15+02:00
reproducible trbo system health check: include job status icons for relevant jobs with issues

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

- - - - -


1 changed file:

- bin/reproducible_system_health.sh


Changes:

=====================================
bin/reproducible_system_health.sh
=====================================
@@ -42,10 +42,10 @@ small_note() {
 }
 
 prepare_log(){
-	if [ -f $JOB/builds/$LAST/log ] ; then
-		cp $JOB/builds/$LAST/log $LOG
-	elif [ -f $JOB/builds/$LAST/log.gz ] ; then
-		zcat $JOB/builds/$LAST/log.gz > $LOG
+	if [ -f $JOB_NAME/builds/$LAST/log ] ; then
+		cp $JOB_NAME/builds/$LAST/log $LOG
+	elif [ -f $JOB_NAME/builds/$LAST/log.gz ] ; then
+		zcat $JOB_NAME/builds/$LAST/log.gz > $LOG
 	else
 		echo > $LOG
 	fi
@@ -54,15 +54,16 @@ prepare_log(){
 # gather data
 echo "$(date -u) - starting up."
 cd /var/lib/jenkins/jobs/
-for JOB in reproducible_* ; do
+for JOB_NAME in reproducible_* ; do
+	JOB_URL="https://jenkins.debian.net/job/$JOB_NAME"
 	#
 	# ignore jobs running on a known offline node or known bad jobs
 	#
 	REMOTE=false
-	case $JOB in
+	case $JOB_NAME in
 		reproducible_builder_fedora*|reproducible_archlinux_html_pages|reproducible_openwrt_rebuilder_future|reproducible_openwrt_rebuilder_today|reproducible_*alpine*)
-			echo "   <li><a href=\"https://jenkins.debian.net/job/$JOB/\">$JOB</a></li>" >> ${KNOWN_BAD_JOBS}
-			echo "  ignored job: $JOB (known to be non-functional)"
+			echo "   <li><a href=\"$JOB_URL/\">$JOB_NAME</a></li>" >> ${KNOWN_BAD_JOBS}
+			echo "  ignored job: $JOB_NAME (known to be non-functional)"
 			let INVALID+=1
 			continue
 			;;
@@ -71,18 +72,18 @@ for JOB in reproducible_* ; do
 			:
 			;;
 		reproducible_setup_schroot_*_diffoscope_amd64_*)
-			NODE_ALIAS=$(echo $JOB | cut -d '_' -f7)
-			NODE_ARCH=$(echo $JOB | cut -d '_' -f6)
+			NODE_ALIAS=$(echo $JOB_NAME | cut -d '_' -f7)
+			NODE_ARCH=$(echo $JOB_NAME | cut -d '_' -f6)
 			REMOTE=true
 			;;
 		reproducible_node_health_check_*|reproducible_setup_pbuilder_*)
-			NODE_ALIAS=$(echo $JOB | cut -d '_' -f6)
-			NODE_ARCH=$(echo $JOB | cut -d '_' -f5)
+			NODE_ALIAS=$(echo $JOB_NAME | cut -d '_' -f6)
+			NODE_ARCH=$(echo $JOB_NAME | cut -d '_' -f5)
 			REMOTE=true
 			;;
 		reproducible_maintenance_*)
-			NODE_ALIAS=$(echo $JOB | cut -d '_' -f4)
-			NODE_ARCH=$(echo $JOB | cut -d '_' -f3)
+			NODE_ALIAS=$(echo $JOB_NAME | cut -d '_' -f4)
+			NODE_ARCH=$(echo $JOB_NAME | cut -d '_' -f3)
 			REMOTE=true
 			;;
 	esac
@@ -104,8 +105,8 @@ for JOB in reproducible_* ; do
 		# jobs one nodes marked down by jenkins are remarked but still counted
 		SUSPECT=false
 		if grep -q $NODE $JENKINS_OFFLINE_GIT_LIST >/dev/null 2>&1 ; then
-			echo "   <li><a href=\"https://jenkins.debian.net/job/$JOB/\">$JOB</a></li>" >> ${IGNORED_JOBS}
-			echo "  ignored job: $JOB (node is marked offline)"
+			echo "   <li><a href=\"$JOB_URL/\">$JOB_NAME</a></li>" >> ${IGNORED_JOBS}
+			echo "  ignored job: $JOB_NAME (node is marked offline)"
 			let INVALID+=1
 			continue
 		elif grep -q $NODE $JENKINS_OFFLINE_LIST >/dev/null 2>&1 ; then
@@ -118,16 +119,16 @@ for JOB in reproducible_* ; do
 	# node is not known offline (in git), let's go
 	#
 	let INPUTS+=1
-	FILE=$JOB/builds/permalinks
+	FILE=$JOB_NAME/builds/permalinks
 	LAST=$(grep lastCompletedBuild $FILE|awk '{print $2}')
 	STABLE=$(grep lastStableBuild $FILE|awk '{print $2}')
 	UNSTABLE=$(grep lastUnstableBuild $FILE|awk '{print $2}')
 	NOTE=""
 	if [ "$LAST" = "$STABLE" ] ; then
-		echo "  stable job: $JOB"
+		echo "  stable job: $JOB_NAME"
 		let SCORE+=3 || SCORE=0
 	elif [ "$LAST" = "$UNSTABLE" ] ; then
-		echo "unstable job: $JOB"
+		echo "unstable job: $JOB_NAME"
 		let SCORE+=1 || SCORE=0
 		prepare_log
 		# only show the most severe problem, don't aggregate them
@@ -147,9 +148,9 @@ for JOB in reproducible_* ; do
 			small_note " (logrotate failed)"
 		fi
 		if ! $SUSPECT ; then
-			echo "   <li><a href=\"https://jenkins.debian.net/job/$JOB/\">$JOB</a>$NOTE</li>" >> ${UNSTABLE_JOBS}
+			echo "   <li><a href=\"$JOB_URL/\"><img src=\"$JOB_URL/badge/icon\">$JOB_NAME</a>$NOTE</li>" >> ${UNSTABLE_JOBS}
 		else
-			echo "   <li><a href=\"https://jenkins.debian.net/job/$JOB/\">$JOB</a>$NOTE</li>" >> ${UNSTABLE_SUSPECTS}
+			echo "   <li><a href=\"$JOB_URL/\">$JOB_NAME</a>$NOTE</li>" >> ${UNSTABLE_SUSPECTS}
 		fi
 	else
 		prepare_log
@@ -165,7 +166,7 @@ for JOB in reproducible_* ; do
 		elif $(grep -q "^ERROR: Failed to make build_install" $LOG) ; then
 			small_note " (make build_install failed)"
 		fi
-		case $JOB in
+		case $JOB_NAME in
 			reproducible_maintenance_amd64_jenkins)			MODIFIER=250 ;; # main node
 			reproducible_maintenance_amd64_profitbricks1)		MODIFIER=500 ;;	# proxy for other nodes
 			reproducible_maintenance_amd64_profitbricks10)		MODIFIER=500 ;;	# proxy for other nodes
@@ -191,18 +192,18 @@ for JOB in reproducible_* ; do
 			let INPUTS-=1
 			continue
 		elif [ $MODIFIER -eq 1 ] ; then
-			echo "  failed job: $JOB"
+			echo "  failed job: $JOB_NAME"
 			if ! $SUSPECT ; then
-				echo "$MODIFIER|   <li><a href=\"https://jenkins.debian.net/job/$JOB/\">$JOB</a>$NOTE</li>" >> ${FAILED_JOBS}
+				echo "$MODIFIER|   <li><a href=\"$JOB_URL/\"><img src=\"$JOB_URL/badge/icon\"> $JOB_NAME</a>$NOTE</li>" >> ${FAILED_JOBS}
 			else
-				echo "$MODIFIER|   <li><a href=\"https://jenkins.debian.net/job/$JOB/\">$JOB</a>$NOTE</li>" >> ${FAILED_SUSPECTS}
+				echo "$MODIFIER|   <li><a href=\"$JOB_URL/\">$JOB_NAME</a>$NOTE</li>" >> ${FAILED_SUSPECTS}
 			fi
 		else
-			echo "  failed job: $JOB - $MODIFIER"
+			echo "  failed job: $JOB_NAME - $MODIFIER"
 			if ! $SUSPECT ; then
-				echo "$MODIFIER|   <li><a href=\"https://jenkins.debian.net/job/$JOB/\">$JOB</a>$NOTE <em>($MODIFIER)</em></li>" >> ${FAILED_JOBS}
+				echo "$MODIFIER|   <li><a href=\"$JOB_URL/\"><img src=\"$JOB_URL/badge/icon\"> $JOB_NAME</a>$NOTE <em>($MODIFIER)</em></li>" >> ${FAILED_JOBS}
 			else
-				echo "$MODIFIER|   <li><a href=\"https://jenkins.debian.net/job/$JOB/\">$JOB</a>$NOTE <em>($MODIFIER)</em></li>" >> ${FAILED_SUSPECTS}
+				echo "$MODIFIER|   <li><a href=\"$JOB_URL/\">$JOB_NAME</a>$NOTE <em>($MODIFIER)</em></li>" >> ${FAILED_SUSPECTS}
 			fi
 		fi
 		let SCORE-=$MODIFIER || SCORE=0



View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/compare/d61964ea2ccaa15c7ed341d26409c102bd269d73...612bc0460414756f29f37b24502e964ffd4152f6

-- 
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/compare/d61964ea2ccaa15c7ed341d26409c102bd269d73...612bc0460414756f29f37b24502e964ffd4152f6
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/20200727/e761c0c2/attachment-0001.html>


More information about the Qa-jenkins-scm mailing list