[Qa-jenkins-scm] [jenkins.debian.net] 05/10: reproducible: refactor how the 'notify on build start' feature is handled, stop abusing of the builder column in the db for this

Holger Levsen holger at moszumanska.debian.org
Wed Dec 9 10:30:06 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 46ddc27f0bbdc0aa0c27541d63460214c4686498
Author: Mattia Rizzolo <mattia at mapreri.org>
Date:   Sun Nov 29 23:30:20 2015 +0000

    reproducible: refactor how the 'notify on build start' feature is handled, stop abusing of the builder column in the db for this
---
 TODO                                 |  1 -
 bin/reproducible_build.sh            |  3 +--
 bin/reproducible_remote_scheduler.py | 22 ++++++++++------------
 3 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/TODO b/TODO
index 918d197..fd6b747 100644
--- a/TODO
+++ b/TODO
@@ -201,7 +201,6 @@ This is about Debian, below are more todo entries for other projects…
 ** use reprepro and snapshot (reprepro gen-snapshot) on alioth to speed up our repo, maybe. maybe we'll just be in sid soon :-)
 ** database issues
 *** stats_build table should have package ids, not just src+suite+arch as primary key
-*** builder column of schedule table should not be used for state-handling of _remote_scheduler.py (by setting it to 'TBD')
 ** send notifications to maintainers when a note to their packages changes?
 ** blacklist script should tell if a package was already blacklisted. also proper options should be used...
 ** _maintenance.sh: delete the history pages once a page has been removed from all suites+archs
diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh
index e825631..87dda59 100755
--- a/bin/reproducible_build.sh
+++ b/bin/reproducible_build.sh
@@ -417,7 +417,6 @@ choose_package() {
 	SAVE_ARTIFACTS=$(echo $RESULT|cut -d "|" -f5)
 	NOTIFY=$(echo $RESULT|cut -d "|" -f6)
 	NOTIFY_MAINTAINER=$(echo $RESULT|cut -d "|" -f7)
-	local DEBUG_URL=$(echo $RESULT|cut -d "|" -f8)	# this is abuse (state-handling...) of the boulder column in the schedule table…
 	# remove previous build attempts which didnt finish correctly:
 	BUILDER_PREFIX="${JOB_NAME#reproducible_builder_}/"
 	BAD_BUILDS=$(mktemp --tmpdir=$TMPDIR)
@@ -464,7 +463,7 @@ choose_package() {
 			;;
 		*)      ;;
 	esac
-	if [ "$DEBUG_URL" = "TBD" ] ; then
+	if [ "$NOTIFY" = "2" ] ; then
 		irc_message "$SRCPACKAGE/$SUITE/$ARCH started building at ${BUILD_URL}console"
 	fi
 	echo "$(date -u ) - starting to build ${SRCPACKAGE}/${SUITE}/${ARCH} on $(hostname -f) on '$DATE'" | tee ${RBUILDLOG}
diff --git a/bin/reproducible_remote_scheduler.py b/bin/reproducible_remote_scheduler.py
index cf8a747..39befb2 100755
--- a/bin/reproducible_remote_scheduler.py
+++ b/bin/reproducible_remote_scheduler.py
@@ -80,7 +80,7 @@ built_before = scheduling_args.before
 packages = [x for x in scheduling_args.packages if x]
 artifacts = scheduling_args.keep_artifacts
 notify = scheduling_args.notify or scheduling_args.noisy
-debug_url = scheduling_args.noisy
+notify_on_start = scheduling_args.noisy
 dry_run = scheduling_args.dry_run
 
 log.debug('Requester: ' + requester)
@@ -89,7 +89,7 @@ log.debug('Local call: ' + str(local))
 log.debug('Reason: ' + reason)
 log.debug('Artifacts: ' + str(artifacts))
 log.debug('Notify: ' + str(notify))
-log.debug('Debug url: ' + str(debug_url))
+log.debug('Debug url: ' + str(notify_on_start))
 log.debug('Issue: ' + issue if issue else str(None))
 log.debug('Status: ' + status if status else str(None))
 log.debug('Date: after ' + built_after if built_after else str(None) +
@@ -151,7 +151,7 @@ if artifacts:
     log.info('The artifacts of the build(s) will be saved to the location '
              'mentioned at the end of the build log(s).')
 
-if debug_url:
+if notify_on_start:
     log.info('The channel will be notified when the build starts')
 
 ids = []
@@ -188,7 +188,7 @@ blablabla = '✂…' if len(' '.join(pkgs)) > 257 else ''
 packages_txt = str(len(ids)) + ' packages ' if len(pkgs) > 1 else ''
 trailing = ' - artifacts will be preserved' if artifacts else ''
 trailing += ' - with irc notification' if notify else ''
-trailing += ' - notify on start too' if debug_url else ''
+trailing += ' - notify on start too' if notify_on_start else ''
 
 message = requester + ' scheduled ' + packages_txt + \
     'in ' + suite + '/' + arch
@@ -232,19 +232,17 @@ if amount + len(ids) > 200 and not local:
 # do the actual scheduling
 to_schedule = []
 save_schedule = []
-notify = '' if not notify else notify
-debug_url = '' if not debug_url else 'TBD'
+notify = 1 if notify else 0
+notify = 2 if notify_on_start else 0
+artifacts_value = 1 if artifacts else 0
 for id in ids:
-    artifacts_value = 1 if artifacts else 0
-    to_schedule.append((id, date, artifacts_value, str(notify).lower(),
-                        requester, debug_url))
+    to_schedule.append((id, date, artifacts_value, str(notify), requester))
     save_schedule.append((id, requester, epoch))
 log.debug('Packages about to be scheduled: ' + str(to_schedule))
 
 query1 = '''REPLACE INTO schedule
-    (package_id, date_scheduled, date_build_started, save_artifacts, notify,
-    scheduler, builder)
-    VALUES (?, ?, "", ?, ?, ?, ?)'''
+    (package_id, date_scheduled, save_artifacts, notify, scheduler)
+    VALUES (?, ?, ?, ?, ?)'''
 query2 = '''INSERT INTO manual_scheduler
     (package_id, requester, date_request) VALUES (?, ?, ?)'''
 

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