Use direct tracing when autobuild build mode specified

Behind a flag, for now
This commit is contained in:
Henry Mercer 2024-04-11 20:31:01 +01:00
parent 5b74166227
commit e37d0f3e7c
24 changed files with 100 additions and 58 deletions

23
lib/tracer-config.js generated
View file

@ -23,14 +23,22 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCombinedTracerConfig = exports.getTracerConfigForCluster = exports.endTracingForCluster = void 0;
exports.getCombinedTracerConfig = exports.getTracerConfigForCluster = exports.endTracingForCluster = exports.shouldEnableIndirectTracing = void 0;
const fs = __importStar(require("fs"));
const path = __importStar(require("path"));
const feature_flags_1 = require("./feature-flags");
const languages_1 = require("./languages");
const tools_features_1 = require("./tools-features");
async function endTracingForCluster(config) {
// If there are no traced languages, we don't need to do anything.
if (!config.languages.some((l) => (0, languages_1.isTracedLanguage)(l)))
const util_1 = require("./util");
async function shouldEnableIndirectTracing(codeql, config, features) {
return ((!config.buildMode ||
config.buildMode === util_1.BuildMode.Manual ||
!(await features.getValue(feature_flags_1.Feature.AutobuildDirectTracingEnabled, codeql))) &&
config.languages.some((l) => (0, languages_1.isTracedLanguage)(l)));
}
exports.shouldEnableIndirectTracing = shouldEnableIndirectTracing;
async function endTracingForCluster(codeql, config, features) {
if (!(await shouldEnableIndirectTracing(codeql, config, features)))
return;
const envVariablesFile = path.resolve(config.dbLocation, "temp/tracingEnvironment/end-tracing.json");
if (!fs.existsSync(envVariablesFile)) {
@ -59,12 +67,9 @@ async function getTracerConfigForCluster(config) {
};
}
exports.getTracerConfigForCluster = getTracerConfigForCluster;
async function getCombinedTracerConfig(codeql, config) {
// Abort if there are no traced languages as there's nothing to do
const tracedLanguages = config.languages.filter((l) => (0, languages_1.isTracedLanguage)(l));
if (tracedLanguages.length === 0) {
async function getCombinedTracerConfig(codeql, config, features) {
if (!(await shouldEnableIndirectTracing(codeql, config, features)))
return undefined;
}
const mainTracerConfig = await getTracerConfigForCluster(config);
// If the CLI doesn't yet support setting the CODEQL_RUNNER environment variable to
// the runner executable path, we set it here in the Action.