Commit 7640a773 authored by Holger Levsen's avatar Holger Levsen
Browse files

further improvements to general jenkins_job_health page

parent a2f215a0
Loading
Loading
Loading
Loading
+34 −12
Original line number Diff line number Diff line
@@ -157,12 +157,14 @@ build_jenkins_job_health_page() {
	# jenkins job health page
	#
	# FIXME: we should really store the output of "$(cd ~/jobs ; ls -1d *)" and only recreate this page if this file doesn't exist or has changed
	# these are simple egrep filters. however, if they contain a colon,
	# the filter is split in two, see $category and $avoid below
	FILTER[0]="maintenance"
	FILTER[1]="udd"
	FILTER[2]="lintian"
	FILTER[3]="piuparts"
	FILTER[4]="debsums"
	FILTER[5]="dpkg"
	FILTER[5]="dpkg:pu-build"
	FILTER[6]="transitional"
	FILTER[7]="edu-packages"
	FILTER[8]="haskell"
@@ -173,24 +175,39 @@ build_jenkins_job_health_page() {
	FILTER[13]="d-i_overview"
	FILTER[14]="d-i_manual"
	FILTER[15]="d-i_build"
	FILTER[16]="d-i_build"
	FILTER[17]="d-i_pu-build"
	FILTER[18]="d-i_schroot"
	FILTER[16]="d-i_pu-build"
	FILTER[17]="d-i_schroot"
	FILTER[18]="d-i_:(overview|manual|build|schroot)"
	FILTER[19]="rebootstrap"
	FILTER[20]="g-i-installation_debian_"
	FILTER[21]="g-i-installation_debian-edu_"
	FILTER[22]="torbrowser-launcher"
	FILTER[23]="debian-archive-keyring"
	FILTER[24]="live"
	FILTER[20]="g-i-installation_debian_jessie:(presentation|rescue)"
	FILTER[21]="g-i-installation_debian_sid:(presentation|rescue)"
	FILTER[22]="g-i-installation_.*presentation"
	FILTER[23]="g-i-installation_.*rescue"
	FILTER[24]="g-i-installation_debian-edu_jessie"
	FILTER[25]="g-i-installation_debian-edu_stretch"
	FILTER[26]="torbrowser-launcher"
	FILTER[27]="debian-archive-keyring"
	FILTER[28]="live:pu-build"
	numfilters=${#FILTER[@]}
	let numfilters-=1	# that's what you get when you start counting from 0
	echo "$(date -u) - starting to write jenkins_job_health page."
	write_page "<!DOCTYPE html><html lang=\"en\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">"
	write_page "<title>Jenkins job health</title/></head><body>"
	for CATEGORY in $(seq 0 $numfilters) ; do
		# $FILTER with a colon are split into $category and $filter
		if $(echo "${FILTER[$CATEGORY]}" | grep -q ":") ; then
			category=$(echo "${FILTER[$CATEGORY]}" | cut -d ":" -f1)
			filter=$(echo "${FILTER[$CATEGORY]}" | cut -d ":" -f2)
		else
			category="${FILTER[$CATEGORY]}"
			filter=""
		fi
		write_page "<p style=\"clear:both;\">"
		write_page "<h3>${FILTER[$CATEGORY]}</h3>"
		for JOB in $(cd ~/jobs ; ls -1d * | grep -v reproducible_ | egrep "${FILTER[$CATEGORY]}" | sort ) ; do
		write_page "<h3>$(echo $category | sed 's#\.\*##g')</h3>"
		for JOB in $(cd ~/jobs ; ls -1d * | grep -v reproducible_ | egrep "$category" | sort ) ; do
			if [ -n "$filter" ] && [[ -n $(echo "$JOB" | egrep "$filter") ]] ; then
				continue
			fi
			URL="https://jenkins.debian.net/job/$JOB"
			BADGE="$URL/badge/icon"
			write_page "<a href='$URL'><img src='$BADGE' /></a> "
@@ -203,7 +220,12 @@ build_jenkins_job_health_page() {
	for JOB in $(cd ~/jobs ; ls -1d * | egrep -v '(reproducible_|lost\+found)' | sort ) ; do
		found=false
		for CATEGORY in $(seq 0 $numfilters) ; do
			if [ -n "$(echo $JOB | egrep ${FILTER[$CATEGORY]} 2>/dev/null|| true )" ] ; then
			if $(echo "${FILTER[$CATEGORY]}" | grep -q ":") ; then
				category=$(echo "${FILTER[$CATEGORY]}" | cut -d ":" -f1)
			else
				category="${FILTER[$CATEGORY]}"
			fi
			if [ -n "$(echo $JOB | egrep "$category" 2>/dev/null|| true )" ] ; then
				found=true
				continue
			fi