summaryrefslogtreecommitdiff
path: root/doc/invocations-http-server
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2025-04-25 12:47:41 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2025-04-25 13:11:59 +0200
commita80dd33b084774ae86a2f09800b32fd5b704f5a1 (patch)
tree1ece63b439bda21a1fede7dbe83d4ecdb78a8353 /doc/invocations-http-server
parent9b9f410d6b08c52ae56563c5970e1d7a5023014c (diff)
downloadjustbuild-a80dd33b084774ae86a2f09800b32fd5b704f5a1.tar.gz
Invocation server: also present the artifacts of an invocation
... if available. This can be useful, when presenting builds that are mainly there to have artifacts available for manual use.
Diffstat (limited to 'doc/invocations-http-server')
-rwxr-xr-xdoc/invocations-http-server/server.py22
-rw-r--r--doc/invocations-http-server/templates/invocation.html16
2 files changed, 38 insertions, 0 deletions
diff --git a/doc/invocations-http-server/server.py b/doc/invocations-http-server/server.py
index b8ea24d5..f64f5439 100755
--- a/doc/invocations-http-server/server.py
+++ b/doc/invocations-http-server/server.py
@@ -43,6 +43,7 @@ class InvocationServer:
def __init__(self, logsdir, *,
just_mr = None,
graph = "graph.json",
+ artifacts = "artifacts.json",
profile = "profile.json",
meta = "meta.json"):
self.logsdir = logsdir
@@ -52,6 +53,7 @@ class InvocationServer:
self.just_mr = just_mr
self.profile = profile
self.graph = graph
+ self.artifacts = artifacts
self.meta = meta
self.templatepath = os.path.join(os.path.dirname(__file__), "templates")
self.jinjaenv = jinja2.Environment(
@@ -214,6 +216,13 @@ class InvocationServer:
except:
graph = {}
+ try:
+ with open(os.path.join(
+ self.logsdir, invocation, self.artifacts)) as f:
+ artifacts = json.load(f)
+ except:
+ artifacts = {}
+
params["repo_config"] = meta.get('configuration')
params["exit_code"] = profile.get('exit code')
# For complex conditional data fill with None as default
@@ -231,6 +240,16 @@ class InvocationServer:
params["config"] = json.dumps(core_config(
profile.get('configuration')))
+ output_artifacts = []
+ for k, v in artifacts.items():
+ output_artifacts.append({
+ "path": k,
+ "basename": os.path.basename(k),
+ "hash": v["id"],
+ "type": "tree" if v["file_type"] == "t" else "blob",
+ })
+ params["artifacts"] = output_artifacts
+
def action_data(name, profile_value):
data = { "name_prefix": "",
"name": name,
@@ -297,6 +316,8 @@ if __name__ == '__main__':
help="Name of the logged metadata file")
parser.add_argument("--graph", dest="graph", default="graph.json",
help="Name of the logged action-graph file")
+ parser.add_argument("--artifacts", dest="artifacts", default="artifacts.json",
+ help="Name of the logged artifacts file")
parser.add_argument("--profile", dest="profile", default="profile.json",
help="Name of the logged profile file")
parser.add_argument(
@@ -318,6 +339,7 @@ if __name__ == '__main__':
app = InvocationServer(args.DIR,
just_mr=just_mr,
graph=args.graph,
+ artifacts=args.artifacts,
meta=args.meta,
profile=args.profile)
make_server(args.interface, args.port, app).serve_forever()
diff --git a/doc/invocations-http-server/templates/invocation.html b/doc/invocations-http-server/templates/invocation.html
index 65ec9127..b09ca0ac 100644
--- a/doc/invocations-http-server/templates/invocation.html
+++ b/doc/invocations-http-server/templates/invocation.html
@@ -96,6 +96,22 @@ Inocations {{invocation | e}}
{% if exit_code != None %}
<li> exit code: {{ exit_code | e }}</li>
{% endif %}
+ {% if artifacts %}
+ <li>
+ <details>
+ <summary>artifacts</summary>
+ <ul>
+ {% for entry in artifacts %}
+ <li>
+ <a href="/{{ entry["type"] | e}}/{{ entry["hash"] | e}}">{{ entry["path"] | e}}</a>
+ {% if entry["type"] == "blob" %}
+ <a href="/blob/{{ entry["hash"] | e}}/{{ entry["basename"] | e}}">[&darr;]</a>
+ {% endif %}
+ </li>
+ {% endfor %}
+ </ul>
+ </details>
+ {% endif %}
</ul>
{% if have_profile %}