Add CLI feature flag to disable Go workaround
This commit is contained in:
parent
604448043e
commit
abb71f14cf
6 changed files with 56 additions and 3 deletions
6
lib/init-action.js
generated
6
lib/init-action.js
generated
|
|
@ -38,6 +38,7 @@ const logging_1 = require("./logging");
|
|||
const repository_1 = require("./repository");
|
||||
const setup_codeql_1 = require("./setup-codeql");
|
||||
const status_report_1 = require("./status-report");
|
||||
const tools_features_1 = require("./tools-features");
|
||||
const trap_caching_1 = require("./trap-caching");
|
||||
const util_1 = require("./util");
|
||||
const workflow_1 = require("./workflow");
|
||||
|
|
@ -161,6 +162,8 @@ async function run() {
|
|||
return;
|
||||
}
|
||||
try {
|
||||
// Query CLI for supported features
|
||||
const versionInfo = await codeql.getVersion();
|
||||
// Forward Go flags
|
||||
const goFlags = process.env["GOFLAGS"];
|
||||
if (goFlags) {
|
||||
|
|
@ -169,7 +172,8 @@ async function run() {
|
|||
}
|
||||
// https://github.com/github/codeql-team/issues/2411
|
||||
if (config.languages.includes(languages_1.Language.go) &&
|
||||
process.platform === "linux") {
|
||||
process.platform === "linux" &&
|
||||
!(0, tools_features_1.isSupportedToolsFeature)(versionInfo, tools_features_1.ToolsFeature.IndirectTracingSupportsStaticBinaries)) {
|
||||
try {
|
||||
const goBinaryPath = await (0, safe_which_1.safeWhich)("go");
|
||||
const fileOutput = await (0, actions_util_1.getFileType)(goBinaryPath);
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
20
lib/tools-features.js
generated
Normal file
20
lib/tools-features.js
generated
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isSupportedToolsFeature = exports.ToolsFeature = void 0;
|
||||
var ToolsFeature;
|
||||
(function (ToolsFeature) {
|
||||
ToolsFeature["FeaturesInVersionResult"] = "featuresInVersionResult";
|
||||
ToolsFeature["IndirectTracingSupportsStaticBinaries"] = "indirectTracingSupportsStaticBinaries";
|
||||
})(ToolsFeature || (exports.ToolsFeature = ToolsFeature = {}));
|
||||
/**
|
||||
* Determines if the given feature is supported by the CLI.
|
||||
*
|
||||
* @param versionInfo Version information, including features, returned by the CLI.
|
||||
* @param feature The feature to check for.
|
||||
* @returns True if the feature is supported or false otherwise.
|
||||
*/
|
||||
function isSupportedToolsFeature(versionInfo, feature) {
|
||||
return !!versionInfo.features && versionInfo.features[feature];
|
||||
}
|
||||
exports.isSupportedToolsFeature = isSupportedToolsFeature;
|
||||
//# sourceMappingURL=tools-features.js.map
|
||||
1
lib/tools-features.js.map
Normal file
1
lib/tools-features.js.map
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"tools-features.js","sourceRoot":"","sources":["../src/tools-features.ts"],"names":[],"mappings":";;;AAEA,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,mEAAmD,CAAA;IACnD,+FAA+E,CAAA;AACjF,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;AAED;;;;;;GAMG;AACH,SAAgB,uBAAuB,CACrC,WAAwB,EACxB,OAAqB;IAErB,OAAO,CAAC,CAAC,WAAW,CAAC,QAAQ,IAAI,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AACjE,CAAC;AALD,0DAKC"}
|
||||
|
|
@ -28,6 +28,7 @@ import {
|
|||
getActionsStatus,
|
||||
sendStatusReport,
|
||||
} from "./status-report";
|
||||
import { ToolsFeature, isSupportedToolsFeature } from "./tools-features";
|
||||
import { getTotalCacheSize } from "./trap-caching";
|
||||
import {
|
||||
checkDiskUsage,
|
||||
|
|
@ -315,6 +316,9 @@ async function run() {
|
|||
}
|
||||
|
||||
try {
|
||||
// Query CLI for supported features
|
||||
const versionInfo = await codeql.getVersion();
|
||||
|
||||
// Forward Go flags
|
||||
const goFlags = process.env["GOFLAGS"];
|
||||
if (goFlags) {
|
||||
|
|
@ -327,7 +331,11 @@ async function run() {
|
|||
// https://github.com/github/codeql-team/issues/2411
|
||||
if (
|
||||
config.languages.includes(Language.go) &&
|
||||
process.platform === "linux"
|
||||
process.platform === "linux" &&
|
||||
!isSupportedToolsFeature(
|
||||
versionInfo,
|
||||
ToolsFeature.IndirectTracingSupportsStaticBinaries,
|
||||
)
|
||||
) {
|
||||
try {
|
||||
const goBinaryPath = await safeWhich("go");
|
||||
|
|
|
|||
20
src/tools-features.ts
Normal file
20
src/tools-features.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { VersionInfo } from "./codeql";
|
||||
|
||||
export enum ToolsFeature {
|
||||
FeaturesInVersionResult = "featuresInVersionResult",
|
||||
IndirectTracingSupportsStaticBinaries = "indirectTracingSupportsStaticBinaries",
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the given feature is supported by the CLI.
|
||||
*
|
||||
* @param versionInfo Version information, including features, returned by the CLI.
|
||||
* @param feature The feature to check for.
|
||||
* @returns True if the feature is supported or false otherwise.
|
||||
*/
|
||||
export function isSupportedToolsFeature(
|
||||
versionInfo: VersionInfo,
|
||||
feature: ToolsFeature,
|
||||
): boolean {
|
||||
return !!versionInfo.features && versionInfo.features[feature];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue