From 8cae99420db70579173ff52f8a30956a0f9e7e3c Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Thu, 9 May 2019 21:54:42 +0200 Subject: webapp: add an index listing recently failed builds --- webapp.py | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/webapp.py b/webapp.py index c6c7d80..52defa3 100644 --- a/webapp.py +++ b/webapp.py @@ -19,6 +19,60 @@ app.config["SQLALCHEMY_DATABASE_URI"] = 'sqlite:///db' app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False db = flask_sqlalchemy.SQLAlchemy(app) +index_template = """ + + + Debian cross build quality assurance + + +
+

Debian cross build quality assurance

+
+
+

Recently failed builds

+ + + + + + + + + + + + {%- for build in builds|sort(attribute='starttime', reverse=true) -%} + + + + + + + + {%- endfor -%} + +
sourceversionarchitecturestartedresult log
+ + {{- build.source|e -}} + + {{ build.version|e }}{{ build.architecture|e }} + {{- build.starttime|sqltimestamp|formatts -}} + + log + xz +
+
+ + + +""" + src_template = """ @@ -225,6 +279,17 @@ def collect_depstate(conn, source): depresult.setdefault(reason, set()).add(arch) return version, depresult +@app.route("/") +def show_index(): + with db.engine.connect() as conn: + builds = list(conn.execute(""" + SELECT source, version, architecture, starttime, filename + FROM builds + WHERE success = 0 + ORDER BY starttime + DESC LIMIT 10;""")) + return flask.render_template_string(index_template, builds=builds) + @app.route("/src/") def show_source(source): context = dict(sourcepackage=source) -- cgit v1.2.3