[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] only recreate jenkins job health page if jobs have changed
Holger Levsen
gitlab at salsa.debian.org
Fri Oct 19 20:20:29 BST 2018
Holger Levsen pushed to branch master at Debian QA / jenkins.debian.net
Commits:
238de5e2 by Holger Levsen at 2018-10-19T19:19:14Z
only recreate jenkins job health page if jobs have changed
Signed-off-by: Holger Levsen <holger at layer-acht.org>
- - - - -
1 changed file:
- bin/maintenance.sh
Changes:
=====================================
bin/maintenance.sh
=====================================
@@ -156,7 +156,7 @@ build_jenkins_job_health_page() {
#
# jenkins job health page
#
- # FIXME: we should store the output of "$(cd ~/jobs ; ls -1d *)" and only recreate this page if this file doesn't exist or has changed
+ echo "$(date -u) - starting to write jenkins_job_health page."
# 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"
@@ -189,7 +189,6 @@ build_jenkins_job_health_page() {
FILTER[27]="live:(pu-build|d-i_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
@@ -203,7 +202,7 @@ build_jenkins_job_health_page() {
fi
write_page "<p style=\"clear:both;\">"
write_page "<h3>$(echo $category | sed 's#\.\*##g')</h3>"
- for JOB in $(cd ~/jobs ; ls -1d * | grep -v reproducible_ | egrep "$category" | sort ) ; do
+ for JOB in $(cat ${JOBS} | grep -v reproducible_ | egrep "$category" | sort ) ; do
if [ -n "$filter" ] && [[ -n $(echo "$JOB" | egrep "$filter") ]] ; then
continue
fi
@@ -214,7 +213,7 @@ build_jenkins_job_health_page() {
write_page "</p>"
done
# find jobs not present in jenkins_job_health.html
- for JOB in $(cd ~/jobs ; ls -1d * | egrep -v '(reproducible_|lost\+found)' | sort ) ; do
+ for JOB in $(cat ${JOBS} | egrep -v '(reproducible_|lost\+found)' | sort ) ; do
found=false
for CATEGORY in $(seq 0 $numfilters) ; do
if $(echo "${FILTER[$CATEGORY]}" | grep -q ":") ; then
@@ -255,7 +254,17 @@ if [ -z $1 ] ; then
general_maintenance
compress_old_jenkins_logs
PAGE=$(mktemp)
- build_jenkins_job_health_page
+ # only recreate jenkins job health page if jobs have changed
+ JOBS=$(mktemp)
+ (cd ~/jobs ; ls -1d * | sort > $JOBS)
+ if [ ! -f ./joblist ] || ! (diff $JOBS ./joblist > /dev/null) ; then
+ echo "$(date -u) - jobs have changed, recreating jenkins_job_health page."
+ build_jenkins_job_health_page
+ mv $JOBS ./joblist
+ else
+ echo "$(date -u) - jobs haven't changed, not recreating jenkins_job_health page."
+ rm $JOBS
+ fi
else
case $1 in
chroot-installation*) wait4idle $1
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/commit/238de5e24a3f2ef511d183b36f886cfa6d5378a1
--
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/commit/238de5e24a3f2ef511d183b36f886cfa6d5378a1
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/20181019/a8db551e/attachment-0001.html>
More information about the Qa-jenkins-scm
mailing list