summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2019-05-09 21:54:42 +0200
committerHelmut Grohne <helmut@subdivi.de>2019-05-09 21:54:42 +0200
commit8cae99420db70579173ff52f8a30956a0f9e7e3c (patch)
tree74f8890552c307cf131dcc671ff75c50826b8bfd
parentd9b341e6d1de3c69be6526ae768d7734a94c4ac0 (diff)
downloadcrossqa-8cae99420db70579173ff52f8a30956a0f9e7e3c.tar.gz
webapp: add an index listing recently failed builds
-rw-r--r--webapp.py65
1 files changed, 65 insertions, 0 deletions
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 = """<!DOCTYPE html>
+<html>
+ <head>
+ <title>Debian cross build quality assurance</title>
+ </head>
+ <body>
+ <header>
+ <h1>Debian cross build quality assurance</h1>
+ </header>
+ <section>
+ <h3>Recently failed builds</h3>
+ <table>
+ <thead>
+ <tr>
+ <th>source</th>
+ <th>version</th>
+ <th>architecture</th>
+ <th>started</th>
+ <th>result log</th>
+ </tr>
+ </thead>
+ <tbody>
+ {%- for build in builds|sort(attribute='starttime', reverse=true) -%}
+ <tr>
+ <td>
+ <a href="{{ url_for("show_source", source=build.source) }}">
+ {{- build.source|e -}}
+ </a>
+ </td>
+ <td>{{ build.version|e }}</td>
+ <td>{{ build.architecture|e }}</td>
+ <td>
+ {{- build.starttime|sqltimestamp|formatts -}}
+ </td>
+ <td>
+ <a href="{{ url_for("show_log", filename=build.filename[:-3]) }}">log</a>
+ <a href="{{ url_for("show_log", filename=build.filename) }}">xz</a>
+ </td>
+ </tr>
+ {%- endfor -%}
+ </tbody>
+ </table>
+ </section>
+ <footer>
+ <h3>Details about this service</h3>
+ <ul>
+ <li>Maintainer: Helmut Grohne &lt;helmut@subdivi.de&gt;</li>
+ <li>Source: git://git.subdivi.de/~helmut/crossqa.git</li>
+ </ul>
+ </footer>
+ </body>
+</html>
+"""
+
src_template = """<!DOCTYPE html>
<html>
<head>
@@ -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/<source>")
def show_source(source):
context = dict(sourcepackage=source)