mirror of
https://github.com/morluto/rea.git
synced 2026-11-19 13:12:26 +00:00
fix(ci): continue after an unreadable timing history candidate (#12245)
This commit is contained in:
1 parent
35f02b2a3c
commit
f7534b10c0
2 files changed
+30
-4
No files matched your search
@@ -86,9 +86,16 @@ function findTimingRun({
|
||||
.slice(0, MAX_CANDIDATES);
|
||||
|
||||
for (const artifact of candidates) {
|
||||
const run = normalizeWorkflowRun(
|
||||
api(`repos/${repository}/actions/runs/${artifact.workflow_run.id}`),
|
||||
);
|
||||
let run;
|
||||
try {
|
||||
run = normalizeWorkflowRun(
|
||||
api(`repos/${repository}/actions/runs/${artifact.workflow_run.id}`),
|
||||
);
|
||||
} catch {
|
||||
// A listed artifact can outlive its run or race a deletion. Its
|
||||
// lineage remains unverified, but the next candidate may still work.
|
||||
continue;
|
||||
}
|
||||
const runAge = now - Date.parse(run?.created_at);
|
||||
if (
|
||||
typeof run?.created_at === "string" &&
|
||||
|
||||
@@ -74,7 +74,7 @@ async function invoke(
|
||||
' node -e \'const fs=require("node:fs"); const x=JSON.parse(fs.readFileSync(process.env.GH_FIXTURE_RESPONSE,"utf8")); process.stdout.write(JSON.stringify({artifacts:x.artifacts}));\'',
|
||||
"else",
|
||||
' run_id="${4##*/}"',
|
||||
' node -e \'const fs=require("node:fs"); const x=JSON.parse(fs.readFileSync(process.env.GH_FIXTURE_RESPONSE,"utf8")); process.stdout.write(JSON.stringify(x.runs[Number(process.argv[1])] ?? {}));\' "$run_id"',
|
||||
' node -e \'const fs=require("node:fs"); const x=JSON.parse(fs.readFileSync(process.env.GH_FIXTURE_RESPONSE,"utf8")); const run=x.runs[Number(process.argv[1])]; if(run===null){console.error("gh: Not Found (HTTP 404)"); process.exit(1);} process.stdout.write(JSON.stringify(run ?? {}));\' "$run_id"',
|
||||
"fi",
|
||||
"",
|
||||
].join("\n"),
|
||||
@@ -325,3 +325,22 @@ it("selects full-tier history without using a newer fast artifact", async () =>
|
||||
artifact_name: "test-timings-full",
|
||||
});
|
||||
});
|
||||
|
||||
it("uses the next valid timing run when one listed run disappears", async () => {
|
||||
const { result, calls } = await invoke(
|
||||
[
|
||||
artifact(81, { created_at: new Date(now - 30_000).toISOString() }),
|
||||
artifact(80),
|
||||
artifact(79),
|
||||
],
|
||||
{ 81: null, 80: run(80), 79: run(79) },
|
||||
{ tier: "full" },
|
||||
);
|
||||
expect(JSON.parse(result.stdout)).toEqual({
|
||||
run_id: "80",
|
||||
artifact_name: "test-timings-full",
|
||||
});
|
||||
expect(calls).toContain("actions/runs/81");
|
||||
expect(calls).toContain("actions/runs/80");
|
||||
expect(calls).not.toContain("actions/runs/79");
|
||||
});
|
||||
Reference in new issue
Block a user