End tracing early in autobuild Action for improved performance and reliability

This lets us achieve some performance and reliability improvements for
workflows that run autobuild directly without specifying a build mode.
This commit is contained in:
Henry Mercer 2024-05-09 15:06:36 +01:00
parent 7a6352f8e6
commit 5ac5c91bc1
9 changed files with 46 additions and 18 deletions

12
lib/tracer-config.js generated
View file

@ -37,9 +37,19 @@ async function shouldEnableIndirectTracing(codeql, config, features) {
config.languages.some((l) => (0, languages_1.isTracedLanguage)(l)));
}
exports.shouldEnableIndirectTracing = shouldEnableIndirectTracing;
async function endTracingForCluster(codeql, config, features) {
/**
* Delete variables as specified by the end-tracing script
*
* WARNING: This does not _really_ end tracing, as the tracer will restore its
* critical environment variables and it'll still be active for all processes
* launched from this build step.
*
* However, it will stop tracing for all steps past the current build step.
*/
async function endTracingForCluster(codeql, config, logger, features) {
if (!(await shouldEnableIndirectTracing(codeql, config, features)))
return;
logger.info("Unsetting build tracing environment variables. Subsequent steps of this job will not be traced.");
const envVariablesFile = path.resolve(config.dbLocation, "temp/tracingEnvironment/end-tracing.json");
if (!fs.existsSync(envVariablesFile)) {
throw new Error(`Environment file for ending tracing not found: ${envVariablesFile}`);