diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2025-05-13 11:58:20 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2025-05-13 12:06:38 +0200 |
commit | ce832dbb4d14e5d46691ed930cfef22dc5d85dd4 (patch) | |
tree | 1ac385ad1e10c57d65a212ff9a6349fd0501aa36 /doc | |
parent | 4da202de2e291a061a7c661bda2e7f1b3dfa28b6 (diff) | |
download | justbuild-ce832dbb4d14e5d46691ed930cfef22dc5d85dd4.tar.gz |
Invocation server: add links to blob references in analysis errors
When using a serve endpoint, analysis errors my contain a reference to
a build failure on serve, shown as 'blob <hash>'. For each such blob
reference add a link offering to read this blob.
Diffstat (limited to 'doc')
-rwxr-xr-x | doc/invocations-http-server/server.py | 10 | ||||
-rw-r--r-- | doc/invocations-http-server/templates/invocation.html | 9 |
2 files changed, 17 insertions, 2 deletions
diff --git a/doc/invocations-http-server/server.py b/doc/invocations-http-server/server.py index 05832ada..6ff6b668 100755 --- a/doc/invocations-http-server/server.py +++ b/doc/invocations-http-server/server.py @@ -15,6 +15,7 @@ import jinja2 import json +import re import os import subprocess import werkzeug.exceptions @@ -328,7 +329,14 @@ class InvocationServer: params["repo_config"] = meta.get('configuration') params["exit_code"] = profile.get('exit code') - params["analysis_errors"] = profile.get('analysis errors', []) + analysis_errors = [] + blob_pattern = re.compile(r'blob ([0-9A-Za-z]{40,64})') + for s in profile.get('analysis errors', []): + analysis_errors.append({ + "msg": s, + "blobs": blob_pattern.findall(s), + }) + params["analysis_errors"] = analysis_errors params["remote_address"] = profile.get('remote', {}).get('address') remote_props = [] for k, v in profile.get('remote', {}).get('properties', {}).items(): diff --git a/doc/invocations-http-server/templates/invocation.html b/doc/invocations-http-server/templates/invocation.html index c8d77f58..50d5690a 100644 --- a/doc/invocations-http-server/templates/invocation.html +++ b/doc/invocations-http-server/templates/invocation.html @@ -158,7 +158,14 @@ Inocations {{invocation | e}} <h2>Analysis errors</h2> <ul> {% for error in analysis_errors %} - <li> <pre>{{ error | e}}</pre></li> + <li> <pre>{{ error["msg"] | e}}</pre> + {% if error["blobs"] %} + Blobs: + {% for blob in error["blobs"] %} + <a href="/blob/{{ blob | e }}"><tt>{{ blob | e }}</tt></a> + {% endfor %} + {% endif %} + </li> {% endfor %} </ul> {% else %} |