summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattia Rizzolo <mattia@mapreri.org>2015-10-19 09:35:36 +0000
committerHolger Levsen <holger@layer-acht.org>2015-12-09 11:28:32 +0100
commit629ea43e9c361d2a2bed28bf093addd849029374 (patch)
tree42ffbb8232bb050bc4e7df826ead048a471cd644
parent46ddc27f0bbdc0aa0c27541d63460214c4686498 (diff)
downloadjenkins.debian.net-629ea43e9c361d2a2bed28bf093addd849029374.tar.xz
reproducible: save the schedule message in the db and show it in the "test history" table
-rwxr-xr-xbin/reproducible_build.sh7
-rwxr-xr-xbin/reproducible_common.py5
-rwxr-xr-xbin/reproducible_db_maintenance.py4
-rwxr-xr-xbin/reproducible_html_packages.py2
-rwxr-xr-xbin/reproducible_remote_scheduler.py8
5 files changed, 17 insertions, 9 deletions
diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh
index 87dda59a..ce471cc1 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 c3a64299..47dc4fe9 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 9bed6591..3eb87192 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 ee35072c..52aca925 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 39befb23..4181ac5f 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 (?, ?, ?)'''