Cross-check Go binary in analyze Action

This commit is contained in:
Michael B. Gale 2023-09-28 11:46:36 +01:00
parent 2bd75f528c
commit 4611ff9b23
No known key found for this signature in database
GPG key ID: FF5E2765BD00628F
3 changed files with 24 additions and 1 deletions

9
lib/analyze-action.js generated
View file

@ -31,6 +31,7 @@ const fs = __importStar(require("fs"));
const path_1 = __importDefault(require("path"));
const perf_hooks_1 = require("perf_hooks");
const core = __importStar(require("@actions/core"));
const safe_which_1 = require("@chrisgavin/safe-which");
const actionsUtil = __importStar(require("./actions-util"));
const analyze_1 = require("./analyze");
const api_client_1 = require("./api-client");
@ -159,6 +160,14 @@ async function run() {
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, actionsUtil.getTemporaryDirectory(), logger);
const memory = util.getMemoryFlag(actionsUtil.getOptionalInput("ram") || process.env["CODEQL_RAM"], logger);
// Check that the Go wrapper script still exists, if set
const goWrapperPath = process.env[environment_1.EnvVar.GO_BINARY_LOCATION];
if (goWrapperPath !== undefined) {
const goBinaryPath = await (0, safe_which_1.safeWhich)("go");
if (goWrapperPath !== goBinaryPath) {
core.warning("Unexpected result for `which go`: please ensure that the correct version of Go is installed before the `codeql-action/init` Action is used.");
}
}
await runAutobuildIfLegacyGoWorkflow(config, logger);
dbCreationTimings = await (0, analyze_1.runFinalize)(outputDir, threads, memory, config, logger, features);
if (actionsUtil.getRequiredInput("skip-queries") !== "true") {

File diff suppressed because one or more lines are too long

View file

@ -3,6 +3,7 @@ import path from "path";
import { performance } from "perf_hooks";
import * as core from "@actions/core";
import { safeWhich } from "@chrisgavin/safe-which";
import * as actionsUtil from "./actions-util";
import {
@ -231,6 +232,19 @@ async function run() {
logger,
);
// Check that the Go wrapper script still exists, if set
const goWrapperPath = process.env[EnvVar.GO_BINARY_LOCATION];
if (goWrapperPath !== undefined) {
const goBinaryPath = await safeWhich("go");
if (goWrapperPath !== goBinaryPath) {
core.warning(
"Unexpected result for `which go`: please ensure that the correct version of Go is installed before the `codeql-action/init` Action is used.",
);
}
}
await runAutobuildIfLegacyGoWorkflow(config, logger);
dbCreationTimings = await runFinalize(