diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2025-04-25 12:47:41 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2025-04-25 13:11:59 +0200 |
commit | a80dd33b084774ae86a2f09800b32fd5b704f5a1 (patch) | |
tree | 1ece63b439bda21a1fede7dbe83d4ecdb78a8353 /doc/invocations-http-server/server.py | |
parent | 9b9f410d6b08c52ae56563c5970e1d7a5023014c (diff) | |
download | justbuild-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/server.py')
-rwxr-xr-x | doc/invocations-http-server/server.py | 22 |
1 files changed, 22 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() |