[Qa-jenkins-scm] [jenkins.debian.net] 02/02: reproducible: refactor, define MAINNODE in _common.sh

Holger Levsen holger at moszumanska.debian.org
Mon Sep 21 15:06:39 UTC 2015


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch master
in repository jenkins.debian.net.

commit 65e621c12e407dbe419ff17b442bc99c0affcd7a
Author: Holger Levsen <holger at layer-acht.org>
Date:   Mon Sep 21 14:25:04 2015 +0200

    reproducible: refactor, define MAINNODE in _common.sh
---
 bin/reproducible_common.sh      | 3 ++-
 bin/reproducible_maintenance.sh | 8 ++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/bin/reproducible_common.sh b/bin/reproducible_common.sh
index 99acef4..c660d3a 100755
--- a/bin/reproducible_common.sh
+++ b/bin/reproducible_common.sh
@@ -9,6 +9,7 @@
 # define db
 PACKAGES_DB=/var/lib/jenkins/reproducible.db
 INIT=/var/lib/jenkins/reproducible.init
+MAINNODE="jenkins" # host which contains reproducible.db
 if [ -f $PACKAGES_DB ] && [ -f $INIT ] ; then
 	if [ -f ${PACKAGES_DB}.lock ] ; then
 		for i in $(seq 0 200) ; do
@@ -23,7 +24,7 @@ if [ -f $PACKAGES_DB ] && [ -f $INIT ] ; then
 			exit 1
 		fi
 	fi
-elif [ ! -f ${PACKAGES_DB} ] && [ "$HOSTNAME" = "jenkins" ] ; then
+elif [ ! -f ${PACKAGES_DB} ] && [ "$HOSTNAME" = "$MAINNODE" ] ; then
 	echo "Warning: $PACKAGES_DB doesn't exist, creating it now."
 		/srv/jenkins/bin/reproducible_db_maintenance.py
 	# 60 seconds timeout when trying to get a lock
diff --git a/bin/reproducible_maintenance.sh b/bin/reproducible_maintenance.sh
index 0fd3893..d466d2e 100755
--- a/bin/reproducible_maintenance.sh
+++ b/bin/reproducible_maintenance.sh
@@ -15,7 +15,7 @@ DIRTY=false
 REP_RESULTS=/srv/reproducible-results
 
 # backup db
-if [ "$HOSTNAME" = "jenkins" ] ; then
+if [ "$HOSTNAME" = "$MAINNODE" ] ; then
 	echo "$(date -u) - backup db and update public copy."
 	# prepare backup
 	mkdir -p $REP_RESULTS/backup
@@ -72,7 +72,7 @@ for s in $SUITES ; do
 	# pbuilder update
 	#
 	# pbuilder aint used on jenkins anymore
-	if [ "$(hostname)" = "jenkins" ] ; then
+	if [ "$HOSTNAME" = "$MAINNODE" ] ; then
 		continue
 	else
 		echo "$(date -u) - updating pbuilder for $s/$ARCH now."
@@ -140,7 +140,7 @@ if [ ! -z "$OLDSTUFF" ] ; then
 	DIRTY=true
 fi
 
-if [ "$HOSTNAME" = "jenkins" ] ; then
+if [ "$HOSTNAME" = "$MAINNODE" ] ; then
 	#
 	# find failed builds due to network problems and reschedule them
 	#
@@ -337,7 +337,7 @@ if [ ! -z "$BADPERMS" ] ; then
 fi
 
 # once a day, send mail about stale builds
-if [ "$HOSTNAME" = "jenkins" ] && [ $(date -u +%H) -eq 0 ]  ; then
+if [ "$HOSTNAME" = "$MAINNODE" ] && [ $(date -u +%H) -eq 0 ]  ; then
 	if [ -s /var/lib/jenkins/stale_builds.txt ] ; then
 		TMPFILE=$(mktemp --tmpdir=$TEMPDIR maintenance-XXXXXXXXXXXX)
 		mv /var/lib/jenkins/stale_builds.txt $TMPFILE

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git



More information about the Qa-jenkins-scm mailing list