From c74659e18e48a18ff8e941ea982eec94c95f5297 Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Sat, 20 Jun 2015 20:26:54 +0000 Subject: reproducible: scheduler,build: accept a --noisy option to tell the builder to announce the build (with the build url) in the IRC channel --- bin/reproducible_build.sh | 6 +++++- bin/reproducible_remote_scheduler.py | 20 +++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) (limited to 'bin') diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh index 8a1522f9..7a0c8bb4 100755 --- a/bin/reproducible_build.sh +++ b/bin/reproducible_build.sh @@ -325,7 +325,7 @@ call_debbindiff() { } choose_package () { - local RESULT=$(sqlite3 -init $INIT ${PACKAGES_DB} "SELECT s.suite, s.id, s.name, sch.date_scheduled, sch.save_artifacts, sch.notify, s.notify_maintainer FROM schedule AS sch JOIN sources AS s ON sch.package_id=s.id WHERE sch.date_build_started = '' ORDER BY date_scheduled LIMIT 1") + local RESULT=$(sqlite3 -init $INIT ${PACKAGES_DB} "SELECT s.suite, s.id, s.name, sch.date_scheduled, sch.save_artifacts, sch.notify, s.notify_maintainer, sch.builder FROM schedule AS sch JOIN sources AS s ON sch.package_id=s.id WHERE sch.date_build_started = '' ORDER BY date_scheduled LIMIT 1") SUITE=$(echo $RESULT|cut -d "|" -f1) SRCPKGID=$(echo $RESULT|cut -d "|" -f2) SRCPACKAGE=$(echo $RESULT|cut -d "|" -f3) @@ -342,6 +342,10 @@ 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) + if [ "$DEBUG_URL" = "TBD" ] ; then + irc_message "The build of $SRCPACKAGE/$SUITE is starting at ${BUILD_URL}consoleFull" + fi if [ -z "$RESULT" ] ; then echo "No packages scheduled, sleeping 30m." sleep 30m diff --git a/bin/reproducible_remote_scheduler.py b/bin/reproducible_remote_scheduler.py index 86f235b3..db4bce4f 100755 --- a/bin/reproducible_remote_scheduler.py +++ b/bin/reproducible_remote_scheduler.py @@ -21,6 +21,8 @@ group.add_argument('-a', '--artifacts', default=False, action='store_true', help='Save artifacts (for further offline study)') group.add_argument('-n', '--no-notify', default=False, action='store_true', help='Do not notify the channel when the build finish') +parser.add_argument('--noisy', action='store_true', help='Also notify when ' + + 'the build start, linking the build url. This disables -n.') parser.add_argument('-m', '--message', default='', nargs='+', help='A text to be sent to the IRC channel when notifying' + ' about the scheduling') @@ -64,13 +66,15 @@ suite = scheduling_args.suite reason = ' '.join(scheduling_args.message) packages = scheduling_args.packages artifacts = scheduling_args.artifacts -notify = not scheduling_args.no_notify # note the notify vs no-notify +notify = not scheduling_args.no_notify or scheduling_args.noisy +debug_url = scheduling_args.noisy log.debug('Requester: ' + requester) 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('Architecture: ' + defaultarch) log.debug('Suite: ' + suite) log.debug('Packages: ' + ' '.join(packages)) @@ -88,10 +92,13 @@ if len(packages) > 50 and notify: 'channel this much use a loop to achive that.' + bcolors.ENDC) sys.exit(1) -if scheduling_args.artifacts: +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: + log.info('The channel will be notified when the build starts') + ids = [] pkgs = [] @@ -166,15 +173,18 @@ if amount + len(ids) > 50 and not local: to_schedule = [] save_schedule = [] notify = '' if not notify else notify +debug_url = '' if not debug_url else 'TBD' for id in ids: artifacts_value = 1 if artifacts else 0 - to_schedule.append((id, date, artifacts_value, str(notify).lower(), requester)) + to_schedule.append((id, date, artifacts_value, str(notify).lower(), + requester, debug_url)) 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) - VALUES (?, ?, "", ?, ?, ?)''' + (package_id, date_scheduled, date_build_started, save_artifacts, notify, + scheduler, builder) + VALUES (?, ?, "", ?, ?, ?, ?)''' query2 = '''INSERT INTO manual_scheduler (package_id, requester, date_request) VALUES (?, ?, ?)''' -- cgit v1.2.3-70-g09d2