Merge pull request #959 from cklin/report-runner-os-arch
Add runner OS and arch to status report
This commit is contained in:
commit
939659ccd0
3 changed files with 24 additions and 1 deletions
8
lib/actions-util.js
generated
8
lib/actions-util.js
generated
|
|
@ -21,6 +21,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.sanitizeArifactName = exports.isAnalyzingDefaultBranch = exports.getRelativeScriptPath = exports.isRunningLocalAction = exports.sendStatusReport = exports.createStatusReportBase = exports.getActionsStatus = exports.getRef = exports.computeAutomationID = exports.getAutomationID = exports.getAnalysisKey = exports.getWorkflowRunID = exports.getWorkflow = exports.formatWorkflowCause = exports.formatWorkflowErrors = exports.validateWorkflow = exports.getWorkflowErrors = exports.WorkflowErrors = exports.patternIsSuperset = exports.determineMergeBaseCommitOid = exports.getCommitOid = exports.getToolCacheDirectory = exports.getTemporaryDirectory = exports.getOptionalInput = exports.getRequiredInput = void 0;
|
exports.sanitizeArifactName = exports.isAnalyzingDefaultBranch = exports.getRelativeScriptPath = exports.isRunningLocalAction = exports.sendStatusReport = exports.createStatusReportBase = exports.getActionsStatus = exports.getRef = exports.computeAutomationID = exports.getAutomationID = exports.getAnalysisKey = exports.getWorkflowRunID = exports.getWorkflow = exports.formatWorkflowCause = exports.formatWorkflowErrors = exports.validateWorkflow = exports.getWorkflowErrors = exports.WorkflowErrors = exports.patternIsSuperset = exports.determineMergeBaseCommitOid = exports.getCommitOid = exports.getToolCacheDirectory = exports.getTemporaryDirectory = exports.getOptionalInput = exports.getRequiredInput = void 0;
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
|
const os = __importStar(require("os"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
|
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
|
||||||
|
|
@ -498,6 +499,8 @@ async function createStatusReportBase(actionName, status, actionStartedAt, cause
|
||||||
workflowStartedAt = actionStartedAt.toISOString();
|
workflowStartedAt = actionStartedAt.toISOString();
|
||||||
core.exportVariable(sharedEnv.CODEQL_WORKFLOW_STARTED_AT, workflowStartedAt);
|
core.exportVariable(sharedEnv.CODEQL_WORKFLOW_STARTED_AT, workflowStartedAt);
|
||||||
}
|
}
|
||||||
|
const runnerOs = (0, util_1.getRequiredEnvParam)("RUNNER_OS");
|
||||||
|
const runnerArch = (0, util_1.getRequiredEnvParam)("RUNNER_ARCH");
|
||||||
// If running locally then the GITHUB_ACTION_REF cannot be trusted as it may be for the previous action
|
// If running locally then the GITHUB_ACTION_REF cannot be trusted as it may be for the previous action
|
||||||
// See https://github.com/actions/runner/issues/803
|
// See https://github.com/actions/runner/issues/803
|
||||||
const actionRef = isRunningLocalAction()
|
const actionRef = isRunningLocalAction()
|
||||||
|
|
@ -516,6 +519,8 @@ async function createStatusReportBase(actionName, status, actionStartedAt, cause
|
||||||
started_at: workflowStartedAt,
|
started_at: workflowStartedAt,
|
||||||
action_started_at: actionStartedAt.toISOString(),
|
action_started_at: actionStartedAt.toISOString(),
|
||||||
status,
|
status,
|
||||||
|
runner_os: runnerOs,
|
||||||
|
runner_arch: runnerArch,
|
||||||
};
|
};
|
||||||
// Add optional parameters
|
// Add optional parameters
|
||||||
if (cause) {
|
if (cause) {
|
||||||
|
|
@ -534,6 +539,9 @@ async function createStatusReportBase(actionName, status, actionStartedAt, cause
|
||||||
if (matrix) {
|
if (matrix) {
|
||||||
statusReport.matrix_vars = matrix;
|
statusReport.matrix_vars = matrix;
|
||||||
}
|
}
|
||||||
|
if (runnerOs === "Windows" || runnerOs === "macOS") {
|
||||||
|
statusReport.runner_os_release = os.release();
|
||||||
|
}
|
||||||
return statusReport;
|
return statusReport;
|
||||||
}
|
}
|
||||||
exports.createStatusReportBase = createStatusReportBase;
|
exports.createStatusReportBase = createStatusReportBase;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,5 @@
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
|
import * as os from "os";
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
|
|
||||||
import * as core from "@actions/core";
|
import * as core from "@actions/core";
|
||||||
|
|
@ -596,6 +597,12 @@ export interface StatusReportBase {
|
||||||
cause?: string;
|
cause?: string;
|
||||||
/** Stack trace of the failure (or undefined if status is not failure). */
|
/** Stack trace of the failure (or undefined if status is not failure). */
|
||||||
exception?: string;
|
exception?: string;
|
||||||
|
/** Action runner operating system (context runner.os). */
|
||||||
|
runner_os: string;
|
||||||
|
/** Action runner hardware architecture (context runner.arch). */
|
||||||
|
runner_arch: string;
|
||||||
|
/** Action runner operating system release (x.y.z from os.release()). */
|
||||||
|
runner_os_release?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getActionsStatus(
|
export function getActionsStatus(
|
||||||
|
|
@ -643,6 +650,9 @@ export async function createStatusReportBase(
|
||||||
workflowStartedAt
|
workflowStartedAt
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
const runnerOs = getRequiredEnvParam("RUNNER_OS");
|
||||||
|
const runnerArch = getRequiredEnvParam("RUNNER_ARCH");
|
||||||
|
|
||||||
// If running locally then the GITHUB_ACTION_REF cannot be trusted as it may be for the previous action
|
// If running locally then the GITHUB_ACTION_REF cannot be trusted as it may be for the previous action
|
||||||
// See https://github.com/actions/runner/issues/803
|
// See https://github.com/actions/runner/issues/803
|
||||||
const actionRef = isRunningLocalAction()
|
const actionRef = isRunningLocalAction()
|
||||||
|
|
@ -662,6 +672,8 @@ export async function createStatusReportBase(
|
||||||
started_at: workflowStartedAt,
|
started_at: workflowStartedAt,
|
||||||
action_started_at: actionStartedAt.toISOString(),
|
action_started_at: actionStartedAt.toISOString(),
|
||||||
status,
|
status,
|
||||||
|
runner_os: runnerOs,
|
||||||
|
runner_arch: runnerArch,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Add optional parameters
|
// Add optional parameters
|
||||||
|
|
@ -683,6 +695,9 @@ export async function createStatusReportBase(
|
||||||
if (matrix) {
|
if (matrix) {
|
||||||
statusReport.matrix_vars = matrix;
|
statusReport.matrix_vars = matrix;
|
||||||
}
|
}
|
||||||
|
if (runnerOs === "Windows" || runnerOs === "macOS") {
|
||||||
|
statusReport.runner_os_release = os.release();
|
||||||
|
}
|
||||||
|
|
||||||
return statusReport;
|
return statusReport;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue