[Qa-jenkins-scm] [jenkins.debian.net] 06/10: reproducible: save the schedule message in the db and show it in the "test history" table

Holger Levsen holger at moszumanska.debian.org
Mon Dec 7 19:56:26 UTC 2015


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

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

commit 1db12ec454f9509d15b377d5db7da161367a04f3
Author: Mattia Rizzolo <mattia at mapreri.org>
Date:   Mon Oct 19 09:35:36 2015 +0000

    reproducible: save the schedule message in the db and show it in the "test history" table
---
 bin/reproducible_build.sh            | 7 ++++---
 bin/reproducible_common.py           | 5 +++--
 bin/reproducible_db_maintenance.py   | 4 ++++
 bin/reproducible_html_packages.py    | 2 +-
 bin/reproducible_remote_scheduler.py | 8 +++++---
 5 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh
index 87dda59..ce471cc 100755
--- a/bin/reproducible_build.sh
+++ b/bin/reproducible_build.sh
@@ -121,8 +121,8 @@ update_db_and_html() {
 	sqlite3 -init $INIT ${PACKAGES_DB} "REPLACE INTO results (package_id, version, status, build_date, build_duration, node1, node2, job) VALUES ('$SRCPKGID', '$VERSION', '$STATUS', '$DATE', '$DURATION', '$NODE1', '$NODE2', '$JOB')" || \
 	sqlite3 -init $INIT ${PACKAGES_DB} "REPLACE INTO results (package_id, version, status, build_date, build_duration, node1, node2, job) VALUES ('$SRCPKGID', '$VERSION', '$STATUS', '$DATE', '$DURATION', '$NODE1', '$NODE2', '$JOB')"
 	if [ ! -z "$DURATION" ] ; then  # this happens when not 404 and not_for_us
-		sqlite3 -init $INIT ${PACKAGES_DB} "INSERT INTO stats_build (name, version, suite, architecture, status, build_date, build_duration, node1, node2, job) VALUES ('$SRCPACKAGE', '$VERSION', '$SUITE', '$ARCH', '$STATUS', '$DATE', '$DURATION', '$NODE1', '$NODE2', '$JOB')" || \
-		sqlite3 -init $INIT ${PACKAGES_DB} "INSERT INTO stats_build (name, version, suite, architecture, status, build_date, build_duration, node1, node2, job) VALUES ('$SRCPACKAGE', '$VERSION', '$SUITE', '$ARCH', '$STATUS', '$DATE', '$DURATION', '$NODE1', '$NODE2', '$JOB')"
+		sqlite3 -init $INIT ${PACKAGES_DB} "INSERT INTO stats_build (name, version, suite, architecture, status, build_date, build_duration, node1, node2, job, schedule_message) VALUES ('$SRCPACKAGE', '$VERSION', '$SUITE', '$ARCH', '$STATUS', '$DATE', '$DURATION', '$NODE1', '$NODE2', '$JOB', '$SCHEDULE_MESSAGE')" || \
+		sqlite3 -init $INIT ${PACKAGES_DB} "INSERT INTO stats_build (name, version, suite, architecture, status, build_date, build_duration, node1, node2, job, schedule_message) VALUES ('$SRCPACKAGE', '$VERSION', '$SUITE', '$ARCH', '$STATUS', '$DATE', '$DURATION', '$NODE1', '$NODE2', '$JOB', '$SCHEDULE_MESSAGE')"
 	fi
 	# unmark build since it's properly finished
 	sqlite3 -init $INIT ${PACKAGES_DB} "DELETE FROM schedule WHERE package_id='$SRCPKGID';" || \
@@ -401,7 +401,7 @@ call_diffoscope_on_changes_files() {
 
 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
+		SELECT s.suite, s.id, s.name, sch.date_scheduled, sch.save_artifacts, sch.notify, s.notify_maintainer, sch.message
 		FROM schedule AS sch JOIN sources AS s ON sch.package_id=s.id
 		WHERE sch.date_build_started=''
 		AND s.architecture='$ARCH'
@@ -417,6 +417,7 @@ choose_package() {
 	SAVE_ARTIFACTS=$(echo $RESULT|cut -d "|" -f5)
 	NOTIFY=$(echo $RESULT|cut -d "|" -f6)
 	NOTIFY_MAINTAINER=$(echo $RESULT|cut -d "|" -f7)
+	SCHEDULE_MESSAGE=$(echo $RESULT|cut -d "|" -f8)
 	# remove previous build attempts which didnt finish correctly:
 	BUILDER_PREFIX="${JOB_NAME#reproducible_builder_}/"
 	BAD_BUILDS=$(mktemp --tmpdir=$TMPDIR)
diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py
index c3a6429..47dc4fe 100755
--- a/bin/reproducible_common.py
+++ b/bin/reproducible_common.py
@@ -734,10 +734,11 @@ class Package:
 
     def _load_history(self):
         keys = ['build ID', 'version', 'suite', 'architecture', 'result',
-            'build date', 'build duration', 'node1', 'node2', 'job']
+            'build date', 'build duration', 'node1', 'node2', 'job',
+            'schedule message']
         query = """
                 SELECT id, version, suite, architecture, status, build_date,
-                    build_duration, node1, node2, job
+                    build_duration, node1, node2, job, schedule_message
                 FROM stats_build WHERE name='{}' ORDER BY build_date DESC
             """.format(self.name)
         results = query_db(query)
diff --git a/bin/reproducible_db_maintenance.py b/bin/reproducible_db_maintenance.py
index 9bed659..3eb8719 100755
--- a/bin/reproducible_db_maintenance.py
+++ b/bin/reproducible_db_maintenance.py
@@ -546,6 +546,10 @@ schema_updates = {
         'DROP TABLE schedule',
         'ALTER TABLE schedule_tmp RENAME TO schedule',
         'INSERT INTO rb_schema VALUES ("25", "' + now + '")'],
+    26: [ # add a column to the schedule table to save the schedule message
+        'ALTER TABLE schedule ADD COLUMN message TEXT',
+        'ALTER TABLE stats_build ADD COLUMN schedule_message TEXT NOT NULL DEFAULT ""',
+        'INSERT INTO rb_schema VALUES ("26", "' + now + '")'],
 }
 
 
diff --git a/bin/reproducible_html_packages.py b/bin/reproducible_html_packages.py
index ee35072..52aca92 100755
--- a/bin/reproducible_html_packages.py
+++ b/bin/reproducible_html_packages.py
@@ -211,7 +211,7 @@ def gen_suites_links(package, current_suite, current_arch):
 
 def gen_history_page(package):
     keys = ('build date', 'version', 'suite', 'architecture', 'result',
-        'build duration', 'node1', 'node2', 'job')
+        'build duration', 'node1', 'node2', 'job', 'schedule message')
     try:
         head = package.history[0]
     except IndexError:
diff --git a/bin/reproducible_remote_scheduler.py b/bin/reproducible_remote_scheduler.py
index 39befb2..4181ac5 100755
--- a/bin/reproducible_remote_scheduler.py
+++ b/bin/reproducible_remote_scheduler.py
@@ -235,14 +235,16 @@ save_schedule = []
 notify = 1 if notify else 0
 notify = 2 if notify_on_start else 0
 artifacts_value = 1 if artifacts else 0
+reason = reason if reason else None
 for id in ids:
-    to_schedule.append((id, date, artifacts_value, str(notify), requester))
+    to_schedule.append((id, date, artifacts_value, str(notify), requester,
+                        reason))
     save_schedule.append((id, requester, epoch))
 log.debug('Packages about to be scheduled: ' + str(to_schedule))
 
 query1 = '''REPLACE INTO schedule
-    (package_id, date_scheduled, save_artifacts, notify, scheduler)
-    VALUES (?, ?, ?, ?, ?)'''
+    (package_id, date_scheduled, save_artifacts, notify, scheduler, message)
+    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