From 4c85052a82aef3904facd3378830355d340b638b Mon Sep 17 00:00:00 2001 From: John Starks Date: Sat, 24 May 2025 07:23:14 +0000 Subject: [PATCH 1/3] petri: add and publish log viewer web code Create a simple client-side HTML+JS solution for parsing and viewing petri logs. Point it to the OpenVMM test results storage account, which will soon be populated automatically. --- .github/workflows/openvmm-docs-ci.yaml | 26 +- .../_jobs/consolidate_and_publish_gh_pages.rs | 11 + petri/logview/index.html | 158 ++++++ petri/logview/test.html | 479 ++++++++++++++++++ 4 files changed, 672 insertions(+), 2 deletions(-) create mode 100644 petri/logview/index.html create mode 100644 petri/logview/test.html diff --git a/.github/workflows/openvmm-docs-ci.yaml b/.github/workflows/openvmm-docs-ci.yaml index 1a1e9bfd17..db955d1892 100644 --- a/.github/workflows/openvmm-docs-ci.yaml +++ b/.github/workflows/openvmm-docs-ci.yaml @@ -556,14 +556,36 @@ jobs: echo "$AgentTempDirNormal/used_artifacts/x64-linux-rustdoc" | flowey v 3 'artifact_use_from_x64-linux-rustdoc' --is-raw-string update echo "$AgentTempDirNormal/used_artifacts/x64-windows-rustdoc" | flowey v 3 'artifact_use_from_x64-windows-rustdoc' --is-raw-string update shell: bash - - name: generate consolidated gh pages html + - name: check if openvmm needs to be cloned run: |- flowey e 3 flowey_core::pipeline::artifact::resolve 1 flowey e 3 flowey_core::pipeline::artifact::resolve 2 flowey e 3 flowey_core::pipeline::artifact::resolve 0 + flowey e 3 flowey_lib_common::git_checkout 0 + flowey v 3 'flowey_lib_common::git_checkout:0:flowey_lib_common/src/git_checkout.rs:469:80' --is-raw-string --condvar flowey_lib_common::git_checkout:1:flowey_lib_common/src/git_checkout.rs:470:46 write-to-env github floweyvar2 + flowey v 3 'flowey_lib_common::git_checkout:1:flowey_lib_common/src/git_checkout.rs:470:46' write-to-env github FLOWEY_CONDITION + shell: bash + - id: flowey_lib_common__git_checkout__1 + uses: actions/checkout@v4 + with: + fetch-depth: '1' + path: repo0 + persist-credentials: ${{ env.floweyvar2 }} + name: checkout repo openvmm + if: ${{ fromJSON(env.FLOWEY_CONDITION) }} + - name: report cloned repo directories + run: |- + flowey v 3 'flowey_lib_common::git_checkout:4:flowey_core/src/node/github_context.rs:55:41' --is-raw-string update --env-source github.workspace <) { ctx.import::(); + ctx.import::(); } fn process_request(request: Self::Request, ctx: &mut NodeCtx<'_>) -> anyhow::Result<()> { @@ -42,14 +43,18 @@ impl SimpleFlowNode for Node { output, } = request; + let repo = ctx.reqv(crate::git_checkout_openvmm_repo::req::GetRepoDir); + let consolidated_html = ctx.emit_rust_stepv("generate consolidated gh pages html", |ctx| { let rendered_guide = rendered_guide.claim(ctx); let rustdoc_windows = rustdoc_windows.claim(ctx); let rustdoc_linux = rustdoc_linux.claim(ctx); + let repo = repo.claim(ctx); |rt| { let rendered_guide = rt.read(rendered_guide); let rustdoc_windows = rt.read(rustdoc_windows); let rustdoc_linux = rt.read(rustdoc_linux); + let repo = rt.read(repo); let consolidated_html = std::env::current_dir()?.join("out").absolute()?; fs_err::create_dir(&consolidated_html)?; @@ -78,6 +83,12 @@ impl SimpleFlowNode for Node { consolidated_html.join("rustdoc/linux"), )?; + // Make petri logview available under `openvmm.dev/test-results/` + flowey_lib_common::_util::copy_dir_all( + repo.join("petri/logview"), + consolidated_html.join("test-results"), + )?; + // as we do not currently have any form of "landing page", // redirect `openvmm.dev` to `openvmm.dev/guide` fs_err::write(consolidated_html.join("index.html"), REDIRECT)?; diff --git a/petri/logview/index.html b/petri/logview/index.html new file mode 100644 index 0000000000..4b3a5d3b6e --- /dev/null +++ b/petri/logview/index.html @@ -0,0 +1,158 @@ + + + + + + Petri test results + + + + + +

Loading

+
+
+ + + \ No newline at end of file diff --git a/petri/logview/test.html b/petri/logview/test.html new file mode 100644 index 0000000000..4b7688e1eb --- /dev/null +++ b/petri/logview/test.html @@ -0,0 +1,479 @@ + + + + + + Petri test results + + + + + + +

Loading

+

+
+
+
+ + +
+
+
+ + + \ No newline at end of file From 56a3c8f99edd1294a8dffe53f4e71c25b79e2420 Mon Sep 17 00:00:00 2001 From: John Starks Date: Tue, 27 May 2025 16:23:26 +0000 Subject: [PATCH 2/3] tweaks --- petri/logview/index.html | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/petri/logview/index.html b/petri/logview/index.html index 4b3a5d3b6e..be5c6a0cfd 100644 --- a/petri/logview/index.html +++ b/petri/logview/index.html @@ -18,12 +18,14 @@ const xmlDoc = parser.parseFromString(xmlText, "text/xml"); const blobs = xmlDoc.getElementsByTagName("Blob"); let blobNames = []; - for (let i = 0; i < blobs.length; i++) { - const name = blobs[i].getElementsByTagName("Name")[0].textContent; - const date = new Date(blobs[i].getElementsByTagName("Creation-Time")[0].textContent); + for (const blob of blobs) { + const name = blob.getElementsByTagName("Name")[0].textContent; + const date = new Date(blob.getElementsByTagName("Creation-Time")[0].textContent); + const metadata = blob.getElementsByTagName("Metadata").map(m => m.textContent); blobNames.push({ name: name, creationTime: date, + metadata: metadata, }); } return blobNames; @@ -40,8 +42,13 @@ for (const blob of blobs) { const nameParts = blob.name.split("/"); let fileName = nameParts[nameParts.length - 1]; - if (fileName !== "petri.jsonl") { - continue; + let failed; + if (fileName === "petri.passed") { + failed = false; + } else if (fileName === "petri.failed") { + failed = true; + } else { + continue; // Not a test result file. } const testName = nameParts[nameParts.length - 2]; const jobName = nameParts[nameParts.length - 3]; @@ -54,7 +61,6 @@ }; } let job = run[jobName]; - const failed = Math.random() < 0.1; // TODO job.failed |= failed; job.tests.push({ name: testName, @@ -97,7 +103,7 @@

Passing jobs

} function getRunList() { - const url = `${baseUrl}?restype=container&comp=list&showonly=files&prefix=runs/`; + const url = `${baseUrl}?restype=container&comp=list&showonly=files&include=metadata&prefix=runs/`; fetch(url) .then(response => response.text()) .then(data => { @@ -119,9 +125,10 @@

Passing jobs

`; for (const run of runs) { + const marker = run.metadata["petrifailed"] > 0 ? "❌" : "✅"; // Cross for failed runs, check for passing runs. html += ` ${run.creationTime.toLocaleString()} - ${run.name} + ${run.name} ${marker} `; } html += ""; From fa39f6ee4c28afd01a5a00bd037029b0cd873775 Mon Sep 17 00:00:00 2001 From: John Starks Date: Tue, 27 May 2025 16:46:50 +0000 Subject: [PATCH 3/3] tweaks --- petri/logview/index.html | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/petri/logview/index.html b/petri/logview/index.html index be5c6a0cfd..c6dd79352c 100644 --- a/petri/logview/index.html +++ b/petri/logview/index.html @@ -13,6 +13,9 @@