monitor: include build_result in jsonseq monitor streaming

In order to avoid having to rely on the output of `osbuild --json`
when using `--progress=JSONSeqMonitor` the monitor needs to include
the `osbuild.pipeline.BuildResult` for each individual stage.

This commit adds those to the montior.
This commit is contained in:
Michael Vogt 2024-08-05 12:35:44 +02:00 committed by Achilleas Koutsou
parent 2cb57f0ed8
commit 5ba7cadd8b
3 changed files with 35 additions and 15 deletions

View file

@ -208,7 +208,7 @@ def test_json_progress_monitor():
mon.log("pipeline 1 message 2")
mon.log("pipeline 1 finished", origin="org.osbuild")
mon.result(osbuild.pipeline.BuildResult(
fake_noop_stage, returncode=0, output="output", error=None))
fake_noop_stage, returncode=0, output="some output", error=None))
mon.finish({"success": True, "name": "test-pipeline-first"})
mon.begin(manifest.pipelines["test-pipeline-second"])
mon.log("pipeline 2 starting", origin="org.osbuild")
@ -268,6 +268,12 @@ def test_json_progress_monitor():
logitem = json.loads(log[i])
assert logitem["message"] == "Finished module org.osbuild.noop"
assert logitem["context"]["id"] == id_start_module
assert logitem["result"] == {
"id": fake_noop_stage.id,
"name": "org.osbuild.noop",
"output": "some output",
"success": True,
}
i += 1
logitem = json.loads(log[i])