Gracefully continue if createStatusReportBase throws (#2225)
Previously, we weren't catching any possible exceptions in `createStatusReportBase` and runs would fail if any of the telemetry sub-items threw exceptions. As telemetry should not block the analysis, we continue here even if the status report throws.
This commit is contained in:
parent
f421cda8e7
commit
7df281f2fe
24 changed files with 505 additions and 418 deletions
|
|
@ -51,32 +51,35 @@ test("createStatusReportBase", async (t) => {
|
|||
"failure cause",
|
||||
"exception stack trace",
|
||||
);
|
||||
t.truthy(statusReport);
|
||||
|
||||
t.is(statusReport.action_name, ActionName.Init);
|
||||
t.is(statusReport.action_oid, "unknown");
|
||||
t.is(typeof statusReport.action_version, "string");
|
||||
t.is(
|
||||
statusReport.action_started_at,
|
||||
new Date("May 19, 2023 05:19:00").toISOString(),
|
||||
);
|
||||
t.is(statusReport.actions_event_name, "dynamic");
|
||||
t.is(statusReport.analysis_key, "analysis-key");
|
||||
t.is(statusReport.build_mode, BuildMode.None);
|
||||
t.is(statusReport.cause, "failure cause");
|
||||
t.is(statusReport.commit_oid, process.env["GITHUB_SHA"]!);
|
||||
t.is(statusReport.exception, "exception stack trace");
|
||||
t.is(statusReport.job_name, process.env["GITHUB_JOB"] || "");
|
||||
t.is(typeof statusReport.job_run_uuid, "string");
|
||||
t.is(statusReport.languages, "java,swift");
|
||||
t.is(statusReport.ref, process.env["GITHUB_REF"]!);
|
||||
t.is(statusReport.runner_available_disk_space_bytes, 100);
|
||||
t.is(statusReport.runner_image_version, process.env["ImageVersion"]);
|
||||
t.is(statusReport.runner_os, process.env["RUNNER_OS"]!);
|
||||
t.is(statusReport.started_at, process.env[EnvVar.WORKFLOW_STARTED_AT]!);
|
||||
t.is(statusReport.status, "failure");
|
||||
t.is(statusReport.workflow_name, process.env["GITHUB_WORKFLOW"] || "");
|
||||
t.is(statusReport.workflow_run_attempt, 2);
|
||||
t.is(statusReport.workflow_run_id, 100);
|
||||
if (statusReport !== undefined) {
|
||||
t.is(statusReport.action_name, ActionName.Init);
|
||||
t.is(statusReport.action_oid, "unknown");
|
||||
t.is(typeof statusReport.action_version, "string");
|
||||
t.is(
|
||||
statusReport.action_started_at,
|
||||
new Date("May 19, 2023 05:19:00").toISOString(),
|
||||
);
|
||||
t.is(statusReport.actions_event_name, "dynamic");
|
||||
t.is(statusReport.analysis_key, "analysis-key");
|
||||
t.is(statusReport.build_mode, BuildMode.None);
|
||||
t.is(statusReport.cause, "failure cause");
|
||||
t.is(statusReport.commit_oid, process.env["GITHUB_SHA"]!);
|
||||
t.is(statusReport.exception, "exception stack trace");
|
||||
t.is(statusReport.job_name, process.env["GITHUB_JOB"] || "");
|
||||
t.is(typeof statusReport.job_run_uuid, "string");
|
||||
t.is(statusReport.languages, "java,swift");
|
||||
t.is(statusReport.ref, process.env["GITHUB_REF"]!);
|
||||
t.is(statusReport.runner_available_disk_space_bytes, 100);
|
||||
t.is(statusReport.runner_image_version, process.env["ImageVersion"]);
|
||||
t.is(statusReport.runner_os, process.env["RUNNER_OS"]!);
|
||||
t.is(statusReport.started_at, process.env[EnvVar.WORKFLOW_STARTED_AT]!);
|
||||
t.is(statusReport.status, "failure");
|
||||
t.is(statusReport.workflow_name, process.env["GITHUB_WORKFLOW"] || "");
|
||||
t.is(statusReport.workflow_run_attempt, 2);
|
||||
t.is(statusReport.workflow_run_id, 100);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -96,7 +99,7 @@ test("createStatusReportBase_firstParty", async (t) => {
|
|||
"failure cause",
|
||||
"exception stack trace",
|
||||
)
|
||||
).first_party_analysis,
|
||||
)?.first_party_analysis,
|
||||
false,
|
||||
);
|
||||
|
||||
|
|
@ -112,7 +115,7 @@ test("createStatusReportBase_firstParty", async (t) => {
|
|||
"failure cause",
|
||||
"exception stack trace",
|
||||
)
|
||||
).first_party_analysis,
|
||||
)?.first_party_analysis,
|
||||
true,
|
||||
);
|
||||
|
||||
|
|
@ -129,7 +132,7 @@ test("createStatusReportBase_firstParty", async (t) => {
|
|||
"failure cause",
|
||||
"exception stack trace",
|
||||
)
|
||||
).first_party_analysis,
|
||||
)?.first_party_analysis,
|
||||
false,
|
||||
);
|
||||
|
||||
|
|
@ -145,7 +148,7 @@ test("createStatusReportBase_firstParty", async (t) => {
|
|||
"failure cause",
|
||||
"exception stack trace",
|
||||
)
|
||||
).first_party_analysis,
|
||||
)?.first_party_analysis,
|
||||
true,
|
||||
);
|
||||
|
||||
|
|
@ -162,7 +165,7 @@ test("createStatusReportBase_firstParty", async (t) => {
|
|||
"failure cause",
|
||||
"exception stack trace",
|
||||
)
|
||||
).first_party_analysis,
|
||||
)?.first_party_analysis,
|
||||
true,
|
||||
);
|
||||
|
||||
|
|
@ -178,7 +181,7 @@ test("createStatusReportBase_firstParty", async (t) => {
|
|||
"failure cause",
|
||||
"exception stack trace",
|
||||
)
|
||||
).first_party_analysis,
|
||||
)?.first_party_analysis,
|
||||
true,
|
||||
);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue