[Qa-jenkins-scm] [jenkins.debian.net] 02/10: reproducible: store in the db also the actual build host in stats_build, and rename the current "builder" field to "job", since it contains the jenkins job name and nummber

Holger Levsen holger at moszumanska.debian.org
Wed Dec 2 14:27:23 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 28890312cc84de454fe9168694dded68096533ff
Author: Mattia Rizzolo <mattia at mapreri.org>
Date:   Thu Oct 15 10:43:44 2015 +0000

    reproducible: store in the db also the actual build host in stats_build, and rename the current "builder" field to "job", since it contains the jenkins job name and nummber
---
 bin/reproducible_build.sh            |  4 ++--
 bin/reproducible_common.py           |  4 ++--
 bin/reproducible_db_maintenance.py   | 22 ++++++++++++++++++++++
 bin/reproducible_html_live_status.py |  2 +-
 bin/reproducible_html_packages.py    |  4 ++--
 5 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh
index 5bc0c49..50c6956 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, builder) VALUES ('$SRCPKGID', '$VERSION', '$STATUS', '$DATE', '$DURATION', '$JOB')" || \
 	sqlite3 -init $INIT ${PACKAGES_DB} "REPLACE INTO results (package_id, version, status, build_date, build_duration, builder) VALUES ('$SRCPKGID', '$VERSION', '$STATUS', '$DATE', '$DURATION', '$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, builder) VALUES ('$SRCPACKAGE', '$VERSION', '$SUITE', '$ARCH', '$STATUS', '$DATE', '$DURATION', '$JOB')" || \
-		sqlite3 -init $INIT ${PACKAGES_DB} "INSERT INTO stats_build (name, version, suite, architecture, status, build_date, build_duration, builder) VALUES ('$SRCPACKAGE', '$VERSION', '$SUITE', '$ARCH', '$STATUS', '$DATE', '$DURATION', '$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) VALUES ('$SRCPACKAGE', '$VERSION', '$SUITE', '$ARCH', '$STATUS', '$DATE', '$DURATION', '$NODE1', '$NODE2', '$JOB')"
 	fi
 	# unmark build since it's properly finished
 	sqlite3 -init $INIT ${PACKAGES_DB} "DELETE FROM schedule WHERE package_id='$SRCPKGID';" || \
diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py
index 6f2772b..c3a6429 100755
--- a/bin/reproducible_common.py
+++ b/bin/reproducible_common.py
@@ -734,10 +734,10 @@ class Package:
 
     def _load_history(self):
         keys = ['build ID', 'version', 'suite', 'architecture', 'result',
-            'build date', 'build duration', 'builder']
+            'build date', 'build duration', 'node1', 'node2', 'job']
         query = """
                 SELECT id, version, suite, architecture, status, build_date,
-                    build_duration, builder
+                    build_duration, node1, node2, job
                 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 33cc38b..47b5063 100755
--- a/bin/reproducible_db_maintenance.py
+++ b/bin/reproducible_db_maintenance.py
@@ -483,6 +483,28 @@ schema_updates = {
         '''DROP TABLE stats_builds_age;''',
         '''ALTER TABLE stats_builds_age_tmp RENAME TO stats_builds_age;''',
         'INSERT INTO rb_schema VALUES ("22", "' + now + '")'],
+    23: [ # save which builders built a package and change the name of the
+          # field keeping the job name
+        '''CREATE TABLE stats_build_tmp
+            (id INTEGER PRIMARY KEY,
+             name TEXT NOT NULL,
+             version TEXT NOT NULL,
+             suite TEXT NOT NULL,
+             architecture TEXT NOT NULL,
+             status TEXT NOT NULL,
+             build_date TEXT NOT NULL,
+             build_duration TEXT NOT NULL,
+             node1 TEXT NOT NULL DEFAULT "",
+             node2 TEXT NOT NULL DEFAULT "",
+             job TEXT NOT NULL,
+             UNIQUE (name, version, suite, architecture, build_date))''',
+        '''INSERT INTO stats_build_tmp (id, name, version, suite, architecture,
+                    status, build_date, build_duration, job)
+           SELECT id, name, version, suite, architecture, status, build_date,
+                    build_duration, builder FROM stats_build''',
+        'DROP TABLE stats_build',
+        'ALTER TABLE stats_build_tmp RENAME TO stats_build',
+        'INSERT INTO rb_schema VALUES ("23", "' + now + '")'],
 }
 
 
diff --git a/bin/reproducible_html_live_status.py b/bin/reproducible_html_live_status.py
index 6d51746..2f044c6 100755
--- a/bin/reproducible_html_live_status.py
+++ b/bin/reproducible_html_live_status.py
@@ -51,7 +51,7 @@ def generate_live_status_table(arch):
     query = 'SELECT s.id, s.suite, s.architecture, s.name, s.version, ' + \
             'p.date_build_started, r.status, r.build_duration, ' + \
             '(SELECT coalesce(AVG(h.build_duration), 0) FROM stats_build AS h WHERE h.status IN ("reproducible", "unreproducible") AND h.name=s.name AND h.suite=s.suite AND h.architecture=s.architecture) ' + \
-            ', p.builder ' + \
+            ', p.job ' + \
             'FROM sources AS s JOIN schedule AS p ON p.package_id=s.id LEFT JOIN results AS r ON s.id=r.package_id ' + \
             'WHERE p.date_build_started != "" AND s.architecture="{arch}" ' + \
             'ORDER BY p.date_build_started DESC'
diff --git a/bin/reproducible_html_packages.py b/bin/reproducible_html_packages.py
index 017a33a..70aca0d 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', 'builder')
+        'build duration', 'node1', 'node2', 'job')
     try:
         head = package.history[0]
     except IndexError:
@@ -222,7 +222,7 @@ def gen_history_page(package):
             html += '<th>{}</th>'.format(i)
         html += '\n{tab}</tr>'.format(tab=tab)
         for record in package.history:
-            # huma formatting of build duration
+            # human formatting of build duration
             record['build duration'] = convert_into_hms_string(
                 int(record['build duration']))
             html += '\n{tab}<tr>\n{tab}{tab}'.format(tab=tab)

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