[Qa-jenkins-scm] [jenkins.debian.net] 01/01: reproducible: improve format of the stale-builds-detected emails

Holger Levsen holger at moszumanska.debian.org
Tue Sep 22 07:59:18 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 a367551661eda24dbe093299e3960775f3f2b040
Author: Holger Levsen <holger at layer-acht.org>
Date:   Tue Sep 22 09:59:02 2015 +0200

    reproducible: improve format of the stale-builds-detected emails
---
 bin/reproducible_build.sh | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh
index 2d6bce0..22df05a 100755
--- a/bin/reproducible_build.sh
+++ b/bin/reproducible_build.sh
@@ -410,20 +410,23 @@ init_package_build() {
 		local ANNOUNCE="Artifacts will be preserved."
 	fi
 	create_results_dirs
-	# used to catch race conditions when the same package is being built by two parallel jobs
+	# used to catch race conditions when the same package is build by two parallel jobs
 	LOCKFILE="/tmp/reproducible-lockfile-${SUITE}-${ARCH}-${SRCPACKAGE}"
 	echo "============================================================================="
 	echo "Initialising reproducibly build of ${SRCPACKAGE} in ${SUITE} on ${ARCH} on $(hostname -f) now. $ANNOUNCE"
 	echo "============================================================================="
 	# remove previous build attempts which didnt finish correctly
 	BUILDER_PREFIX="${JOB_NAME#reproducible_builder_}/"
-	BAD_BUILDS=$(sqlite3 -init $INIT ${PACKAGES_DB} "SELECT package_id, date_build_started, builder FROM schedule WHERE builder LIKE '${BUILDER_PREFIX}%'")
-	if [ ! -z "$BAD_BUILDS" ] ; then
+	BAD_BUILDS=$(mktemp --tmpdir=$TMPDIR)
+	sqlite3 -init $INIT ${PACKAGES_DB} "SELECT package_id, date_build_started, builder FROM schedule WHERE builder LIKE '${BUILDER_PREFIX}%'" > $BAD_BUILDS
+	if [ -s "$BAD_BUILDS" ] ; then
 		# stale_builds.txt is mailed once a day by reproducible_maintenance.sh
-		echo "$(date -u) - stale builds detected, cleaning up database from these entries:" | tee -a /var/lib/jenkins/stale_builds.txt
-		echo -n $BAD_BUILDS | tee -a /var/lib/jenkins/stale_builds.txt
+		echo "$(date -u) - stale builds found, cleaning db from these:" | tee -a /var/lib/jenkins/stale_builds.txt
+		cat $BAD_BUILDS | tee -a /var/lib/jenkins/stale_builds.txt
 		sqlite3 -init $INIT ${PACKAGES_DB} "UPDATE schedule SET date_build_started='' WHERE builder LIKE '${BUILDER_PREFIX}%'"
+		echo >> /var/lib/jenkins/stale_builds.txt
 	fi
+	rm -f $BAD_BUILDS
 	# mark build attempt
 	if [ -z "$(sqlite3 -init $INIT ${PACKAGES_DB} "SELECT date_build_started FROM schedule WHERE package_id = '$SRCPKGID'")" ] ; then
 		sqlite3 -init $INIT ${PACKAGES_DB} "UPDATE schedule SET date_build_started='$DATE', builder='$BUILDER' WHERE package_id = '$SRCPKGID'"

-- 
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