Julian Andres Klode has proposed merging 
~juliank/autopkgtest-cloud:feat-web-release-health into 
autopkgtest-cloud:master.

Requested reviews:
  Canonical's Ubuntu QA (canonical-ubuntu-qa)

For more details, see:
https://code.launchpad.net/~juliank/autopkgtest-cloud/+git/autopkgtest-cloud/+merge/463210

I quickly whipped up this release health dashboard to give a quick overview of 
migration-reference/0 test status (which is what britney looks at when it 
investigates if a failure is a regression).

This may be useful for noble specifically after migrating the time_t changes.
-- 
Your team Canonical's Ubuntu QA is requested to review the proposed merge of 
~juliank/autopkgtest-cloud:feat-web-release-health into 
autopkgtest-cloud:master.
diff --git a/charms/focal/autopkgtest-web/webcontrol/browse.cgi b/charms/focal/autopkgtest-web/webcontrol/browse.cgi
index e9bf6b3..7c6a99e 100755
--- a/charms/focal/autopkgtest-web/webcontrol/browse.cgi
+++ b/charms/focal/autopkgtest-web/webcontrol/browse.cgi
@@ -430,6 +430,58 @@ def package_release_arch(package, release, arch, _=None):
     )
 
 
+@app.route("/releases/<release>")
+@app.route("/releases/<release>/<arch>")
+def release(release, arch=None):
+    arches = [arch] if arch else get_release_arches()[release]
+    reference_results = {}
+    # The query gives us all packages that have autopkgtests (are in the test column),
+    # but the result columns may be NULL thanks to the left join, so we can print N/A.
+    # We order by ascending run_id so a later run overrides an earlier one.
+    for package, version, run_id, run_arch, raw_code in db_con.execute(
+        "SELECT current_version.package, current_version.version, run_id, arch, exitcode "
+        "FROM current_version "
+        "JOIN test ON test.release = current_version.release "
+        "             AND test.package = current_version.package "
+        "LEFT JOIN result ON test.id == result.test_id "
+        "             AND result.version == current_version.version "
+        "WHERE current_version.release = ? "
+        "AND (triggers == 'migration-reference/0' OR triggers IS NULL) "
+        "ORDER BY current_version.package, run_id ASC",
+        (release,),
+    ):
+        code = None
+        show_retry = False
+        url = None
+        if run_id:
+            code = human_exitcode(raw_code)
+            # Version + triggers uniquely identifies this result
+            show_retry = code != "pass"
+            url = os.path.join(
+                swift_container_url % release,
+                release,
+                run_arch,
+                srchash(package),
+                package,
+                run_id,
+            )
+        reference_results.setdefault((package, version), {})[run_arch] = {
+            "version": version,
+            "run_id": run_id,
+            "code": code,
+            "show_retry": show_retry,
+            "url": url,
+        }
+
+    return render(
+        "browse-health.html",
+        release=release,
+        arches=arches,
+        reference_results=reference_results,
+        title_suffix="- %s/%s" % (release, arch) if arch else "- %s" % release,
+    )
+
+
 @app.route("/running")
 def running():
     (releases, arches, queues_info) = get_queues_info()
diff --git a/charms/focal/autopkgtest-web/webcontrol/templates/browse-health.html b/charms/focal/autopkgtest-web/webcontrol/templates/browse-health.html
new file mode 100644
index 0000000..5d36cab
--- /dev/null
+++ b/charms/focal/autopkgtest-web/webcontrol/templates/browse-health.html
@@ -0,0 +1,45 @@
+{% extends "browse-layout.html" %}
+{% import "macros.html" as macros %}
+
+{% block content %}
+  <h2><a href="{{base_url}}packages/{{package}}">{{package}}</a> <small>[{{release}}/{{arch}}]</small></h2>
+  <ul class="external-links">
+    <li>
+      {{ macros.launchpad_link(package, release) }}
+    </li>
+    <li>
+      {{ macros.excuses_link(package, release) }}
+    </li>
+  </ul>
+
+  <table class="table">
+    <tr>
+      <td><b>Package</b></td>
+      <td><b>Version</b></td>
+  {% for arch in arches %}
+  <td>{{arch}}</td>
+  {% endfor %}
+    </tr>
+
+  {% for package, version in reference_results %}
+    <tr>
+        <td>{{package}}</td>
+        <td>{{version}}</td>
+  {% for arch in arches %}
+    {% set values = reference_results[package, version].get(arch, None) %}
+    {% set code = values["code"] if values else "N/A" %}
+    <td class="nowrap {{code}}" title={{code}}>
+      {% if values %}
+        <a href="{{values["url"]}}/log.gz">{{values["code"]}}</a> &emsp;
+        {% if values["show_retry"] %}
+            <a href="{{base_url}}request.cgi?release={{release}}&arch={{values["arch"]}}&package={{package|urlencode}}&trigger=migration-reference/0">&#9851;</a>
+        {% endif %}
+      {% else %}
+      N/A
+      {% endif %}
+    </td>
+    {% endfor %}
+    </tr>
+  {% endfor %}
+  </table>
+{% endblock %}
-- 
Mailing list: https://launchpad.net/~canonical-ubuntu-qa
Post to     : canonical-ubuntu-qa@lists.launchpad.net
Unsubscribe : https://launchpad.net/~canonical-ubuntu-qa
More help   : https://help.launchpad.net/ListHelp

Reply via email to