Skip to content

Commit

Permalink
Add runner image version to status report
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry Mercer committed Aug 7, 2023
1 parent 7dcb3e5 commit 3b25789
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions lib/status-report.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/status-report.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions lib/status-report.test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/status-report.test.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/status-report.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ test("createStatusReportBase", async (t) => {
process.env["GITHUB_RUN_ATTEMPT"] = "2";
process.env["GITHUB_RUN_ID"] = "100";
process.env["GITHUB_SHA"] = "a".repeat(40);
process.env["ImageVersion"] = "2023.05.19.1";
process.env["RUNNER_OS"] = "macOS";

const getRequiredInput = sinon.stub(actionsUtil, "getRequiredInput");
Expand Down Expand Up @@ -48,6 +49,7 @@ test("createStatusReportBase", async (t) => {
t.is(typeof statusReport.job_run_uuid, "string");
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");
Expand Down
8 changes: 8 additions & 0 deletions src/status-report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ export interface StatusReportBase {
runner_arch?: string;
/** Available disk space on the runner, in bytes. */
runner_available_disk_space_bytes: number;
/**
* Version of the runner image, for workflows running on GitHub-hosted runners. Absent otherwise.
*/
runner_image_version?: string;
/** Action runner operating system (context runner.os). */
runner_os: string;
/** Action runner operating system release (x.y.z from os.release()). */
Expand Down Expand Up @@ -240,6 +244,10 @@ export async function createStatusReportBase(
if (codeQlCliVersion !== undefined) {
statusReport.codeql_version = codeQlCliVersion;
}
const imageVersion = process.env["ImageVersion"];
if (imageVersion) {
statusReport.runner_image_version = imageVersion;
}

return statusReport;
}
Expand Down

0 comments on commit 3b25789

Please sign in to comment.