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

11
lib/analyze.js generated
View file

@ -225,13 +225,10 @@ async function runFinalize(outputDir, threadsFlag, memoryFlag, codeql, config, f
}
await fs.promises.mkdir(outputDir, { recursive: true });
const timings = await finalizeDatabaseCreation(codeql, config, threadsFlag, memoryFlag, logger);
// 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 codeql-action/analyze
// step.
// Delete variables as specified by the end-tracing script
await (0, tracer_config_1.endTracingForCluster)(codeql, config, features);
// If we didn't already end tracing in the autobuild Action, end it now.
if (process.env[environment_1.EnvVar.AUTOBUILD_DID_COMPLETE_SUCCESSFULLY] !== "true") {
await (0, tracer_config_1.endTracingForCluster)(codeql, config, logger, features);
}
return timings;
}
exports.runFinalize = runFinalize;