Override `CODEQL_EXTRACTOR_GO_BUILD_TRACING` with `on` when it's `true`

This commit is contained in:
Henry Mercer 2022-08-24 11:34:00 +01:00
Родитель 3069613ebd
Коммит e195431677
33 изменённых файлов: 162 добавлений и 95 удалений

4
lib/analyze.js сгенерированный
Просмотреть файл

@ -74,7 +74,7 @@ async function createdDBForScannedLanguages(codeql, config, logger, featureFlags
// we extract any scanned languages.
analysisPaths.includeAndExcludeAnalysisPaths(config);
for (const language of config.languages) {
if ((0, languages_1.isScannedLanguage)(language) &&
if ((0, languages_1.isScannedLanguage)(language, logger) &&
!dbIsFinalized(config, language, logger)) {
logger.startGroup(`Extracting ${language}`);
if (language === languages_1.Language.python) {
@ -303,7 +303,7 @@ async function runFinalize(outputDir, threadsFlag, memoryFlag, config, logger, f
// step.
if (await util.codeQlVersionAbove(codeql, codeql_1.CODEQL_VERSION_NEW_TRACING)) {
// Delete variables as specified by the end-tracing script
await (0, tracer_config_1.endTracingForCluster)(config);
await (0, tracer_config_1.endTracingForCluster)(config, logger);
}
else {
// Delete the tracer config env var to avoid tracing ourselves

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

2
lib/autobuild.js сгенерированный
Просмотреть файл

@ -8,7 +8,7 @@ function determineAutobuildLanguage(config, logger) {
// We want pick the dominant language in the repo from the ones we're able to build
// The languages are sorted in order specified by user or by lines of code if we got
// them from the GitHub API, so try to build the first language on the list.
const autobuildLanguages = config.languages.filter(languages_1.isTracedLanguage);
const autobuildLanguages = config.languages.filter((l) => (0, languages_1.isTracedLanguage)(l, logger));
const language = autobuildLanguages[0];
if (!language) {
logger.info("None of the languages in this project require extra build steps");

Просмотреть файл

@ -1 +1 @@
{"version":3,"file":"autobuild.js","sourceRoot":"","sources":["../src/autobuild.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AAErC,2CAAyD;AAGzD,SAAgB,0BAA0B,CACxC,MAA2B,EAC3B,MAAc;IAEd,0CAA0C;IAC1C,mFAAmF;IACnF,oFAAoF;IACpF,4EAA4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,CAC5B,CAAC;IACF,MAAM,QAAQ,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAEvC,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,CAAC,IAAI,CACT,iEAAiE,CAClE,CAAC;QACF,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,CAAC,KAAK,CAAC,sCAAsC,QAAQ,EAAE,CAAC,CAAC;IAE/D,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE;QACjC,MAAM,CAAC,OAAO,CACZ,oCAAoC,QAAQ,8BAA8B,kBAAkB;aACzF,KAAK,CAAC,CAAC,CAAC;aACR,IAAI,CAAC,OAAO,CAAC,uDAAuD,CACxE,CAAC;KACH;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AA/BD,gEA+BC;AAEM,KAAK,UAAU,YAAY,CAChC,QAAkB,EAClB,MAA2B,EAC3B,MAAc;IAEd,MAAM,CAAC,UAAU,CAAC,qCAAqC,QAAQ,OAAO,CAAC,CAAC;IACxE,MAAM,MAAM,GAAG,MAAM,IAAA,kBAAS,EAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACjD,MAAM,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IACpC,MAAM,CAAC,QAAQ,EAAE,CAAC;AACpB,CAAC;AATD,oCASC"}

6
lib/codeql.js сгенерированный
Просмотреть файл

@ -486,9 +486,9 @@ async function getCodeQLForCmd(cmd, checkVersion) {
...getExtraOptionsFromEnv(["database", "init"]),
]);
},
async databaseInitCluster(config, sourceRoot, processName, processLevel, featureFlags) {
async databaseInitCluster(config, sourceRoot, processName, processLevel, featureFlags, logger) {
const extraArgs = config.languages.map((language) => `--language=${language}`);
if (config.languages.filter(languages_1.isTracedLanguage).length > 0) {
if (config.languages.filter((l) => (0, languages_1.isTracedLanguage)(l, logger)).length > 0) {
extraArgs.push("--begin-tracing");
extraArgs.push(...(await (0, trap_caching_1.getTrapCachingExtractorConfigArgs)(config)));
if (processName !== undefined) {
@ -506,7 +506,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
// so don't use Lua tracing when tracing Go on Windows.
// Once we've released a fix, we should add a version gate based on the fixed version.
!(config.languages.includes(languages_1.Language.go) &&
(0, languages_1.isTracedLanguage)(languages_1.Language.go) &&
(0, languages_1.isTracedLanguage)(languages_1.Language.go, logger) &&
process.platform === "win32")) {
extraArgs.push("--internal-use-lua-tracing");
}

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

14
lib/codeql.test.js сгенерированный
Просмотреть файл

@ -305,7 +305,7 @@ for (const [isFeatureFlagEnabled, toolsInput, shouldToolcacheBeBypassed,] of TOO
const runnerConstructorStub = stubToolRunnerConstructor();
const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves("2.9.0");
await codeqlObject.databaseInitCluster(stubConfig, "", undefined, undefined, (0, feature_flags_1.createFeatureFlags)([feature_flags_1.FeatureFlag.LuaTracerConfigEnabled]));
await codeqlObject.databaseInitCluster(stubConfig, "", undefined, undefined, (0, feature_flags_1.createFeatureFlags)([feature_flags_1.FeatureFlag.LuaTracerConfigEnabled]), (0, logging_1.getRunnerLogger)(true));
t.false(runnerConstructorStub.firstCall.args[1].includes("--internal-use-lua-tracing"), "--internal-use-lua-tracing should be absent, but it is present");
t.false(runnerConstructorStub.firstCall.args[1].includes("--no-internal-use-lua-tracing"), "--no-internal-use-lua-tracing should be absent, but it is present");
});
@ -313,7 +313,7 @@ for (const [isFeatureFlagEnabled, toolsInput, shouldToolcacheBeBypassed,] of TOO
const runnerConstructorStub = stubToolRunnerConstructor();
const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves("2.9.0");
await codeqlObject.databaseInitCluster(stubConfig, "", undefined, undefined, (0, feature_flags_1.createFeatureFlags)([]));
await codeqlObject.databaseInitCluster(stubConfig, "", undefined, undefined, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
t.false(runnerConstructorStub.firstCall.args[1].includes("--internal-use-lua-tracing"), "--internal-use-lua-tracing should be absent, but it is present");
t.false(runnerConstructorStub.firstCall.args[1].includes("--no-internal-use-lua-tracing"), "--no-internal-use-lua-tracing should be absent, but it is present");
});
@ -321,14 +321,14 @@ for (const [isFeatureFlagEnabled, toolsInput, shouldToolcacheBeBypassed,] of TOO
const runnerConstructorStub = stubToolRunnerConstructor();
const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves("2.10.0");
await codeqlObject.databaseInitCluster(stubConfig, "", undefined, undefined, (0, feature_flags_1.createFeatureFlags)([feature_flags_1.FeatureFlag.LuaTracerConfigEnabled]));
await codeqlObject.databaseInitCluster(stubConfig, "", undefined, undefined, (0, feature_flags_1.createFeatureFlags)([feature_flags_1.FeatureFlag.LuaTracerConfigEnabled]), (0, logging_1.getRunnerLogger)(true));
t.true(runnerConstructorStub.firstCall.args[1].includes("--internal-use-lua-tracing"), "--internal-use-lua-tracing should be present, but it is absent");
});
(0, ava_1.default)("databaseInitCluster() Lua feature flag disabled, compatible CLI", async (t) => {
const runnerConstructorStub = stubToolRunnerConstructor();
const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves("2.10.0");
await codeqlObject.databaseInitCluster(stubConfig, "", undefined, undefined, (0, feature_flags_1.createFeatureFlags)([]));
await codeqlObject.databaseInitCluster(stubConfig, "", undefined, undefined, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
t.true(runnerConstructorStub.firstCall.args[1].includes("--no-internal-use-lua-tracing"), "--no-internal-use-lua-tracing should be present, but it is absent");
});
(0, ava_1.default)("databaseInitCluster() without injected codescanning config", async (t) => {
@ -345,7 +345,7 @@ for (const [isFeatureFlagEnabled, toolsInput, shouldToolcacheBeBypassed,] of TOO
packsInputCombines: false,
},
};
await codeqlObject.databaseInitCluster(thisStubConfig, "", undefined, undefined, (0, feature_flags_1.createFeatureFlags)([]));
await codeqlObject.databaseInitCluster(thisStubConfig, "", undefined, undefined, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
const args = runnerConstructorStub.firstCall.args[1];
// should NOT have used an config file
const configArg = args.find((arg) => arg.startsWith("--codescanning-config="));
@ -370,7 +370,7 @@ const injectedConfigMacro = ava_1.default.macro({
tempDir,
augmentationProperties,
};
await codeqlObject.databaseInitCluster(thisStubConfig, "", undefined, undefined, (0, feature_flags_1.createFeatureFlags)([]));
await codeqlObject.databaseInitCluster(thisStubConfig, "", undefined, undefined, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
const args = runnerConstructorStub.firstCall.args[1];
// should have used an config file
const configArg = args.find((arg) => arg.startsWith("--codescanning-config="));
@ -574,7 +574,7 @@ const injectedConfigMacro = ava_1.default.macro({
sinon
.stub(codeqlObject, "getVersion")
.resolves(codeql.CODEQL_VERSION_CONFIG_FILES);
await codeqlObject.databaseInitCluster(stubConfig, "", undefined, undefined, (0, feature_flags_1.createFeatureFlags)([]));
await codeqlObject.databaseInitCluster(stubConfig, "", undefined, undefined, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
const args = runnerConstructorStub.firstCall.args[1];
// should have used an config file
const configArg = args.find((arg) => arg.startsWith("--codescanning-config="));

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

2
lib/init-action.js сгенерированный
Просмотреть файл

@ -138,7 +138,7 @@ async function run() {
(0, util_1.getMemoryFlagValue)((0, actions_util_1.getOptionalInput)("ram")).toString());
core.exportVariable("CODEQL_THREADS", (0, util_1.getThreadsFlagValue)((0, actions_util_1.getOptionalInput)("threads"), logger).toString());
const sourceRoot = path.resolve((0, util_1.getRequiredEnvParam)("GITHUB_WORKSPACE"), (0, actions_util_1.getOptionalInput)("source-root") || "");
const tracerConfig = await (0, init_1.runInit)(codeql, config, sourceRoot, "Runner.Worker.exe", undefined, featureFlags);
const tracerConfig = await (0, init_1.runInit)(codeql, config, sourceRoot, "Runner.Worker.exe", undefined, featureFlags, logger);
if (tracerConfig !== undefined) {
for (const [key, value] of Object.entries(tracerConfig.env)) {
core.exportVariable(key, value);

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

6
lib/init.js сгенерированный
Просмотреть файл

@ -46,13 +46,13 @@ async function initConfig(languagesInput, queriesInput, packsInput, configFile,
return config;
}
exports.initConfig = initConfig;
async function runInit(codeql, config, sourceRoot, processName, processLevel, featureFlags) {
async function runInit(codeql, config, sourceRoot, processName, processLevel, featureFlags, logger) {
var _a, _b;
fs.mkdirSync(config.dbLocation, { recursive: true });
try {
if (await (0, util_1.codeQlVersionAbove)(codeql, codeql_1.CODEQL_VERSION_NEW_TRACING)) {
// Init a database cluster
await codeql.databaseInitCluster(config, sourceRoot, processName, processLevel, featureFlags);
await codeql.databaseInitCluster(config, sourceRoot, processName, processLevel, featureFlags, logger);
}
else {
for (const language of config.languages) {
@ -77,7 +77,7 @@ async function runInit(codeql, config, sourceRoot, processName, processLevel, fe
throw e;
}
}
return await (0, tracer_config_1.getCombinedTracerConfig)(config, codeql);
return await (0, tracer_config_1.getCombinedTracerConfig)(config, codeql, logger);
}
exports.runInit = runInit;
// Runs a powershell script to inject the tracer into a parent process

Просмотреть файл

@ -1 +1 @@
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,yEAA2D;AAC3D,kEAAoD;AAEpD,gEAAkD;AAElD,qCAA2E;AAC3E,4DAA8C;AAI9C,mDAAwE;AACxE,6CAA+B;AAC/B,iCAA4C;AAErC,KAAK,UAAU,UAAU,CAC9B,SAA6B,EAC7B,UAA4B,EAC5B,OAAe,EACf,OAA2B,EAC3B,YAA0B,EAC1B,MAAc;IAEd,MAAM,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACxC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,I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AAC;QAClB,MAAM,CAAC,OAAO,CACZ,gFAAgF,CAAC,IAAI;YACnF,qGAAqG;YACrG,oGAAoG;YACpG,iDAAiD,CACpD,CAAC;QACF,OAAO;KACR;IACD,MAAM,CAAC,QAAQ,EAAE,CAAC;AACpB,CAAC;AAzCD,8CAyCC"}

32
lib/languages.js сгенерированный
Просмотреть файл

@ -1,6 +1,26 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.isScannedLanguage = exports.isTracedLanguage = exports.parseLanguage = exports.Language = void 0;
const core = __importStar(require("@actions/core"));
// All the languages supported by CodeQL
var Language;
(function (Language) {
@ -35,18 +55,20 @@ function parseLanguage(language) {
return undefined;
}
exports.parseLanguage = parseLanguage;
function isTracedLanguage(language) {
function isTracedLanguage(language, logger) {
if (process.env["CODEQL_EXTRACTOR_GO_BUILD_TRACING"] === "true") {
throw new Error("The CODEQL_EXTRACTOR_GO_BUILD_TRACING environment variable is set to an invalid value. " +
"To enable Go build tracing, please set it to 'on'.");
logger.warning("The CODEQL_EXTRACTOR_GO_BUILD_TRACING environment variable was set to 'true', but it must " +
"be 'on' to enable Go build tracing. Setting it to 'on'.");
process.env["CODEQL_EXTRACTOR_GO_BUILD_TRACING"] = "on";
core.exportVariable("CODEQL_EXTRACTOR_GO_BUILD_TRACING", "on");
}
return (["cpp", "java", "csharp", "swift"].includes(language) ||
(process.env["CODEQL_EXTRACTOR_GO_BUILD_TRACING"] === "on" &&
language === Language.go));
}
exports.isTracedLanguage = isTracedLanguage;
function isScannedLanguage(language) {
return !isTracedLanguage(language);
function isScannedLanguage(language, logger) {
return !isTracedLanguage(language, logger);
}
exports.isScannedLanguage = isScannedLanguage;
//# sourceMappingURL=languages.js.map

Просмотреть файл

@ -1 +1 @@
{"version":3,"file":"languages.js","sourceRoot":"","sources":["../src/languages.ts"],"names":[],"mappings":";;;AAAA,wCAAwC;AACxC,IAAY,QASX;AATD,WAAY,QAAQ;IAClB,6BAAiB,CAAA;IACjB,uBAAW,CAAA;IACX,qBAAS,CAAA;IACT,yBAAa,CAAA;IACb,qCAAyB,CAAA;IACzB,6BAAiB,CAAA;IACjB,yBAAa,CAAA;IACb,2BAAe,CAAA;AACjB,CAAC,EATW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QASnB;AAED,iCAAiC;AACjC,MAAM,gBAAgB,GAAiC;IACrD,CAAC,EAAE,QAAQ,CAAC,GAAG;IACf,KAAK,EAAE,QAAQ,CAAC,GAAG;IACnB,IAAI,EAAE,QAAQ,CAAC,MAAM;IACrB,UAAU,EAAE,QAAQ,CAAC,UAAU;CAChC,CAAC;AAEF,gGAAgG;AAChG,SAAgB,aAAa,CAAC,QAAgB;IAC5C,0BAA0B;IAC1B,QAAQ,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;IAElC,6BAA6B;IAC7B,IAAI,QAAQ,IAAI,QAAQ,EAAE;QACxB,OAAO,QAAoB,CAAC;KAC7B;IAED,yBAAyB;IACzB,IAAI,QAAQ,IAAI,gBAAgB,EAAE;QAChC,OAAO,gBAAgB,CAAC,QAAQ,CAAC,CAAC;KACnC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAfD,sCAeC;AAED,SAAgB,gBAAgB,CAAC,QAAkB;IACjD,IAAI,OAAO,CAAC,GAAG,CAA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,yBAAyB;IACzB,IAAI,QAAQ,IAAI,gBAAgB,EAAE;QAChC,OAAO,gBAAgB,CAAC,QAAQ,CAAC,CAAC;KACnC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAfD,sCAeC;AAED,SAAgB,gBAAgB,CAAC,QAAkB,EAAE,MAAc;IACjE,IAAI,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,KAAK,MAAM,EAAE;QAC/D,MAAM,CAAC,OAAO,CACZ,4FAA4F;YAC1F,yDAAyD,CAC5D,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,GAAG,IAAI,CAAC;QACxD,IAAI,CAAC,cAAc,CAAC,mCAAmC,EAAE,IAAI,CAAC,CAAC;KAChE;IAED,OAAO,CACL,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACrD,CAAC,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,KAAK,IAAI;YACxD,QAAQ,KAAK,QAAQ,CAAC,EAAE,CAAC,CAC5B,CAAC;AACJ,CAAC;AAfD,4CAeC;AAED,SAAgB,iBAAiB,CAAC,QAAkB,EAAE,MAAc;IAClE,OAAO,CAAC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAC7C,CAAC;AAFD,8CAEC"}

27
lib/languages.test.js сгенерированный
Просмотреть файл

@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", { value: true });
const ava_1 = __importDefault(require("ava"));
const languages_1 = require("./languages");
const logging_1 = require("./logging");
const testing_utils_1 = require("./testing-utils");
(0, testing_utils_1.setupTests)(ava_1.default);
(0, ava_1.default)("parseLanguage", async (t) => {
@ -26,19 +27,21 @@ const testing_utils_1 = require("./testing-utils");
t.deepEqual((0, languages_1.parseLanguage)(""), undefined);
});
(0, ava_1.default)("isTracedLanguage", async (t) => {
t.true((0, languages_1.isTracedLanguage)(languages_1.Language.cpp));
t.true((0, languages_1.isTracedLanguage)(languages_1.Language.java));
t.true((0, languages_1.isTracedLanguage)(languages_1.Language.csharp));
t.false((0, languages_1.isTracedLanguage)(languages_1.Language.go));
t.false((0, languages_1.isTracedLanguage)(languages_1.Language.javascript));
t.false((0, languages_1.isTracedLanguage)(languages_1.Language.python));
const logger = (0, logging_1.getRunnerLogger)(true);
t.true((0, languages_1.isTracedLanguage)(languages_1.Language.cpp, logger));
t.true((0, languages_1.isTracedLanguage)(languages_1.Language.java, logger));
t.true((0, languages_1.isTracedLanguage)(languages_1.Language.csharp, logger));
t.false((0, languages_1.isTracedLanguage)(languages_1.Language.go, logger));
t.false((0, languages_1.isTracedLanguage)(languages_1.Language.javascript, logger));
t.false((0, languages_1.isTracedLanguage)(languages_1.Language.python, logger));
});
(0, ava_1.default)("isScannedLanguage", async (t) => {
t.false((0, languages_1.isScannedLanguage)(languages_1.Language.cpp));
t.false((0, languages_1.isScannedLanguage)(languages_1.Language.java));
t.false((0, languages_1.isScannedLanguage)(languages_1.Language.csharp));
t.true((0, languages_1.isScannedLanguage)(languages_1.Language.go));
t.true((0, languages_1.isScannedLanguage)(languages_1.Language.javascript));
t.true((0, languages_1.isScannedLanguage)(languages_1.Language.python));
const logger = (0, logging_1.getRunnerLogger)(true);
t.false((0, languages_1.isScannedLanguage)(languages_1.Language.cpp, logger));
t.false((0, languages_1.isScannedLanguage)(languages_1.Language.java, logger));
t.false((0, languages_1.isScannedLanguage)(languages_1.Language.csharp, logger));
t.true((0, languages_1.isScannedLanguage)(languages_1.Language.go, logger));
t.true((0, languages_1.isScannedLanguage)(languages_1.Language.javascript, logger));
t.true((0, languages_1.isScannedLanguage)(languages_1.Language.python, logger));
});
//# sourceMappingURL=languages.test.js.map

Просмотреть файл

@ -1 +1 @@
{"version":3,"file":"languages.test.js","sourceRoot":"","sources":["../src/languages.test.ts"],"names":[],"mappings":";;;;;AAAA,8CAAuB;AAEvB,2CAKqB;AACrB,mD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AAC,KAAK,CAAC,IAAA,4BAAgB,EAAC,oBAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AACrD,CAAC,CAAC,CAAC;AAEH,IAAA,aAAI,EAAC,mBAAmB,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IACpC,MAAM,MAAM,GAAG,IAAA,yBAAe,EAAC,IAAI,CAAC,CAAC;IAErC,CAAC,CAAC,KAAK,CAAC,IAAA,6BAAiB,EAAC,oBAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;IACjD,CAAC,CAAC,KAAK,CAAC,IAAA,6BAAiB,EAAC,oBAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAClD,CAAC,CAAC,KAAK,CAAC,IAAA,6BAAiB,EAAC,oBAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAEpD,CAAC,CAAC,IAAI,CAAC,IAAA,6BAAiB,EAAC,oBAAQ,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;IAC/C,CAAC,CAAC,IAAI,CAAC,IAAA,6BAAiB,EAAC,oBAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;IACvD,CAAC,CAAC,IAAI,CAAC,IAAA,6BAAiB,EAAC,oBAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AACrD,CAAC,CAAC,CAAC"}

2
lib/runner.js сгенерированный
Просмотреть файл

@ -158,7 +158,7 @@ program
const workspacePath = checkoutPath;
const config = await (0, init_1.initConfig)(cmd.languages, cmd.queries, cmd.packs, cmd.configFile, undefined, false, false, "", "", (0, repository_1.parseRepositoryNwo)(cmd.repository), tempDir, codeql, workspacePath, gitHubVersion, apiDetails, (0, feature_flags_1.createFeatureFlags)([]), logger);
const sourceRoot = checkoutPath;
const tracerConfig = await (0, init_1.runInit)(codeql, config, sourceRoot, parseTraceProcessName(), parseTraceProcessLevel(), (0, feature_flags_1.createFeatureFlags)([]));
const tracerConfig = await (0, init_1.runInit)(codeql, config, sourceRoot, parseTraceProcessName(), parseTraceProcessLevel(), (0, feature_flags_1.createFeatureFlags)([]), logger);
if (tracerConfig === undefined) {
return;
}

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

8
lib/tracer-config.js сгенерированный
Просмотреть файл

@ -33,9 +33,9 @@ const CRITICAL_TRACER_VARS = new Set([
"SEMMLE_DEPTRACE_SOCKET",
"SEMMLE_JAVA_TOOL_OPTIONS",
]);
async function endTracingForCluster(config) {
async function endTracingForCluster(config, logger) {
// If there are no traced languages, we don't need to do anything.
if (!config.languages.some(languages_1.isTracedLanguage))
if (!config.languages.some((l) => (0, languages_1.isTracedLanguage)(l, logger)))
return;
const envVariablesFile = path.resolve(config.dbLocation, "temp/tracingEnvironment/end-tracing.json");
if (!fs.existsSync(envVariablesFile)) {
@ -189,9 +189,9 @@ function concatTracerConfigs(tracerConfigs, config, writeBothEnvironments = fals
return { env, spec };
}
exports.concatTracerConfigs = concatTracerConfigs;
async function getCombinedTracerConfig(config, codeql) {
async function getCombinedTracerConfig(config, codeql, logger) {
// Abort if there are no traced languages as there's nothing to do
const tracedLanguages = config.languages.filter(languages_1.isTracedLanguage);
const tracedLanguages = config.languages.filter((l) => (0, languages_1.isTracedLanguage)(l, logger));
if (tracedLanguages.length === 0) {
return undefined;
}

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

5
lib/tracer-config.test.js сгенерированный
Просмотреть файл

@ -28,6 +28,7 @@ const ava_1 = __importDefault(require("ava"));
const codeql_1 = require("./codeql");
const configUtils = __importStar(require("./config-utils"));
const languages_1 = require("./languages");
const logging_1 = require("./logging");
const testing_utils_1 = require("./testing-utils");
const tracer_config_1 = require("./tracer-config");
const util = __importStar(require("./util"));
@ -275,7 +276,7 @@ function getTestConfig(tmpDir) {
};
},
});
t.deepEqual(await (0, tracer_config_1.getCombinedTracerConfig)(config, codeQL), undefined);
t.deepEqual(await (0, tracer_config_1.getCombinedTracerConfig)(config, codeQL, (0, logging_1.getRunnerLogger)(true)), undefined);
});
});
(0, ava_1.default)("getCombinedTracerConfig - valid spec file", async (t) => {
@ -299,7 +300,7 @@ function getTestConfig(tmpDir) {
};
},
});
const result = await (0, tracer_config_1.getCombinedTracerConfig)(config, codeQL);
const result = await (0, tracer_config_1.getCombinedTracerConfig)(config, codeQL, (0, logging_1.getRunnerLogger)(true));
t.notDeepEqual(result, undefined);
const expectedEnv = {
foo: "bar",

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -128,7 +128,7 @@ export async function createdDBForScannedLanguages(
for (const language of config.languages) {
if (
isScannedLanguage(language) &&
isScannedLanguage(language, logger) &&
!dbIsFinalized(config, language, logger)
) {
logger.startGroup(`Extracting ${language}`);
@ -522,7 +522,7 @@ export async function runFinalize(
// step.
if (await util.codeQlVersionAbove(codeql, CODEQL_VERSION_NEW_TRACING)) {
// Delete variables as specified by the end-tracing script
await endTracingForCluster(config);
await endTracingForCluster(config, logger);
} else {
// Delete the tracer config env var to avoid tracing ourselves
delete process.env[sharedEnv.ODASA_TRACER_CONFIGURATION];

Просмотреть файл

@ -11,7 +11,9 @@ export function determineAutobuildLanguage(
// We want pick the dominant language in the repo from the ones we're able to build
// The languages are sorted in order specified by user or by lines of code if we got
// them from the GitHub API, so try to build the first language on the list.
const autobuildLanguages = config.languages.filter(isTracedLanguage);
const autobuildLanguages = config.languages.filter((l) =>
isTracedLanguage(l, logger)
);
const language = autobuildLanguages[0];
if (!language) {

Просмотреть файл

@ -450,7 +450,8 @@ test("databaseInitCluster() Lua feature flag enabled, but old CLI", async (t) =>
"",
undefined,
undefined,
createFeatureFlags([FeatureFlag.LuaTracerConfigEnabled])
createFeatureFlags([FeatureFlag.LuaTracerConfigEnabled]),
getRunnerLogger(true)
);
t.false(
runnerConstructorStub.firstCall.args[1].includes(
@ -476,7 +477,8 @@ test("databaseInitCluster() Lua feature flag disabled, with old CLI", async (t)
"",
undefined,
undefined,
createFeatureFlags([])
createFeatureFlags([]),
getRunnerLogger(true)
);
t.false(
runnerConstructorStub.firstCall.args[1].includes(
@ -502,7 +504,8 @@ test("databaseInitCluster() Lua feature flag enabled, compatible CLI", async (t)
"",
undefined,
undefined,
createFeatureFlags([FeatureFlag.LuaTracerConfigEnabled])
createFeatureFlags([FeatureFlag.LuaTracerConfigEnabled]),
getRunnerLogger(true)
);
t.true(
runnerConstructorStub.firstCall.args[1].includes(
@ -522,7 +525,8 @@ test("databaseInitCluster() Lua feature flag disabled, compatible CLI", async (t
"",
undefined,
undefined,
createFeatureFlags([])
createFeatureFlags([]),
getRunnerLogger(true)
);
t.true(
runnerConstructorStub.firstCall.args[1].includes(
@ -553,7 +557,8 @@ test("databaseInitCluster() without injected codescanning config", async (t) =>
"",
undefined,
undefined,
createFeatureFlags([])
createFeatureFlags([]),
getRunnerLogger(true)
);
const args = runnerConstructorStub.firstCall.args[1];
@ -595,7 +600,8 @@ const injectedConfigMacro = test.macro({
"",
undefined,
undefined,
createFeatureFlags([])
createFeatureFlags([]),
getRunnerLogger(true)
);
const args = runnerConstructorStub.firstCall.args[1];
@ -904,7 +910,8 @@ test("does not use injected config", async (t: ExecutionContext<unknown>) => {
"",
undefined,
undefined,
createFeatureFlags([])
createFeatureFlags([]),
getRunnerLogger(true)
);
const args = runnerConstructorStub.firstCall.args[1];

Просмотреть файл

@ -91,7 +91,8 @@ export interface CodeQL {
sourceRoot: string,
processName: string | undefined,
processLevel: number | undefined,
featureFlags: FeatureFlags
featureFlags: FeatureFlags,
logger: Logger
): Promise<void>;
/**
* Runs the autobuilder for the given language.
@ -770,12 +771,15 @@ async function getCodeQLForCmd(
sourceRoot: string,
processName: string | undefined,
processLevel: number | undefined,
featureFlags: FeatureFlags
featureFlags: FeatureFlags,
logger: Logger
) {
const extraArgs = config.languages.map(
(language) => `--language=${language}`
);
if (config.languages.filter(isTracedLanguage).length > 0) {
if (
config.languages.filter((l) => isTracedLanguage(l, logger)).length > 0
) {
extraArgs.push("--begin-tracing");
extraArgs.push(...(await getTrapCachingExtractorConfigArgs(config)));
if (processName !== undefined) {
@ -796,7 +800,7 @@ async function getCodeQLForCmd(
// Once we've released a fix, we should add a version gate based on the fixed version.
!(
config.languages.includes(Language.go) &&
isTracedLanguage(Language.go) &&
isTracedLanguage(Language.go, logger) &&
process.platform === "win32"
)
) {

Просмотреть файл

@ -275,7 +275,8 @@ async function run() {
sourceRoot,
"Runner.Worker.exe",
undefined,
featureFlags
featureFlags,
logger
);
if (tracerConfig !== undefined) {
for (const [key, value] of Object.entries(tracerConfig.env)) {

Просмотреть файл

@ -88,7 +88,8 @@ export async function runInit(
sourceRoot: string,
processName: string | undefined,
processLevel: number | undefined,
featureFlags: FeatureFlags
featureFlags: FeatureFlags,
logger: Logger
): Promise<TracerConfig | undefined> {
fs.mkdirSync(config.dbLocation, { recursive: true });
@ -100,7 +101,8 @@ export async function runInit(
sourceRoot,
processName,
processLevel,
featureFlags
featureFlags,
logger
);
} else {
for (const language of config.languages) {
@ -132,7 +134,7 @@ export async function runInit(
throw e;
}
}
return await getCombinedTracerConfig(config, codeql);
return await getCombinedTracerConfig(config, codeql, logger);
}
// Runs a powershell script to inject the tracer into a parent process

Просмотреть файл

@ -6,6 +6,7 @@ import {
isTracedLanguage,
parseLanguage,
} from "./languages";
import { getRunnerLogger } from "./logging";
import { setupTests } from "./testing-utils";
setupTests(test);
@ -32,21 +33,25 @@ test("parseLanguage", async (t) => {
});
test("isTracedLanguage", async (t) => {
t.true(isTracedLanguage(Language.cpp));
t.true(isTracedLanguage(Language.java));
t.true(isTracedLanguage(Language.csharp));
const logger = getRunnerLogger(true);
t.false(isTracedLanguage(Language.go));
t.false(isTracedLanguage(Language.javascript));
t.false(isTracedLanguage(Language.python));
t.true(isTracedLanguage(Language.cpp, logger));
t.true(isTracedLanguage(Language.java, logger));
t.true(isTracedLanguage(Language.csharp, logger));
t.false(isTracedLanguage(Language.go, logger));
t.false(isTracedLanguage(Language.javascript, logger));
t.false(isTracedLanguage(Language.python, logger));
});
test("isScannedLanguage", async (t) => {
t.false(isScannedLanguage(Language.cpp));
t.false(isScannedLanguage(Language.java));
t.false(isScannedLanguage(Language.csharp));
const logger = getRunnerLogger(true);
t.true(isScannedLanguage(Language.go));
t.true(isScannedLanguage(Language.javascript));
t.true(isScannedLanguage(Language.python));
t.false(isScannedLanguage(Language.cpp, logger));
t.false(isScannedLanguage(Language.java, logger));
t.false(isScannedLanguage(Language.csharp, logger));
t.true(isScannedLanguage(Language.go, logger));
t.true(isScannedLanguage(Language.javascript, logger));
t.true(isScannedLanguage(Language.python, logger));
});

Просмотреть файл

@ -1,3 +1,7 @@
import * as core from "@actions/core";
import { Logger } from "./logging";
// All the languages supported by CodeQL
export enum Language {
csharp = "csharp",
@ -36,12 +40,14 @@ export function parseLanguage(language: string): Language | undefined {
return undefined;
}
export function isTracedLanguage(language: Language): boolean {
export function isTracedLanguage(language: Language, logger: Logger): boolean {
if (process.env["CODEQL_EXTRACTOR_GO_BUILD_TRACING"] === "true") {
throw new Error(
"The CODEQL_EXTRACTOR_GO_BUILD_TRACING environment variable is set to an invalid value. " +
"To enable Go build tracing, please set it to 'on'."
logger.warning(
"The CODEQL_EXTRACTOR_GO_BUILD_TRACING environment variable was set to 'true', but it must " +
"be 'on' to enable Go build tracing. Setting it to 'on'."
);
process.env["CODEQL_EXTRACTOR_GO_BUILD_TRACING"] = "on";
core.exportVariable("CODEQL_EXTRACTOR_GO_BUILD_TRACING", "on");
}
return (
@ -51,6 +57,6 @@ export function isTracedLanguage(language: Language): boolean {
);
}
export function isScannedLanguage(language: Language): boolean {
return !isTracedLanguage(language);
export function isScannedLanguage(language: Language, logger: Logger): boolean {
return !isTracedLanguage(language, logger);
}

Просмотреть файл

@ -263,7 +263,8 @@ program
sourceRoot,
parseTraceProcessName(),
parseTraceProcessLevel(),
createFeatureFlags([])
createFeatureFlags([]),
logger
);
if (tracerConfig === undefined) {
return;

Просмотреть файл

@ -6,6 +6,7 @@ import test from "ava";
import { setCodeQL } from "./codeql";
import * as configUtils from "./config-utils";
import { Language } from "./languages";
import { getRunnerLogger } from "./logging";
import { setupTests } from "./testing-utils";
import {
concatTracerConfigs,
@ -329,7 +330,10 @@ test("getCombinedTracerConfig - return undefined when no languages are traced la
},
});
t.deepEqual(await getCombinedTracerConfig(config, codeQL), undefined);
t.deepEqual(
await getCombinedTracerConfig(config, codeQL, getRunnerLogger(true)),
undefined
);
});
});
@ -359,7 +363,11 @@ test("getCombinedTracerConfig - valid spec file", async (t) => {
},
});
const result = await getCombinedTracerConfig(config, codeQL);
const result = await getCombinedTracerConfig(
config,
codeQL,
getRunnerLogger(true)
);
t.notDeepEqual(result, undefined);
const expectedEnv = {

Просмотреть файл

@ -4,6 +4,7 @@ import * as path from "path";
import { CodeQL, CODEQL_VERSION_NEW_TRACING } from "./codeql";
import * as configUtils from "./config-utils";
import { Language, isTracedLanguage } from "./languages";
import { Logger } from "./logging";
import * as util from "./util";
import { codeQlVersionAbove } from "./util";
@ -21,10 +22,11 @@ const CRITICAL_TRACER_VARS = new Set([
]);
export async function endTracingForCluster(
config: configUtils.Config
config: configUtils.Config,
logger: Logger
): Promise<void> {
// If there are no traced languages, we don't need to do anything.
if (!config.languages.some(isTracedLanguage)) return;
if (!config.languages.some((l) => isTracedLanguage(l, logger))) return;
const envVariablesFile = path.resolve(
config.dbLocation,
@ -223,10 +225,13 @@ export function concatTracerConfigs(
export async function getCombinedTracerConfig(
config: configUtils.Config,
codeql: CodeQL
codeql: CodeQL,
logger: Logger
): Promise<TracerConfig | undefined> {
// Abort if there are no traced languages as there's nothing to do
const tracedLanguages = config.languages.filter(isTracedLanguage);
const tracedLanguages = config.languages.filter((l) =>
isTracedLanguage(l, logger)
);
if (tracedLanguages.length === 0) {
return undefined;
}