Bump verbosity when running autobuild script directly in debug mode

This commit is contained in:
Henry Mercer 2024-03-13 17:51:08 +00:00
parent 362c407426
commit 649f3e87e1
9 changed files with 30 additions and 8 deletions

View file

@ -162,7 +162,7 @@ export async function runAutobuild(
if (language === Language.cpp) {
await setupCppAutobuild(codeQL, logger);
}
await codeQL.runAutobuild(language);
await codeQL.runAutobuild(language, config.debugMode);
if (language === Language.go) {
core.exportVariable(EnvVar.DID_AUTOBUILD_GOLANG, "true");
}

View file

@ -82,7 +82,7 @@ export interface CodeQL {
/**
* Runs the autobuilder for the given language.
*/
runAutobuild(language: Language): Promise<void>;
runAutobuild(language: Language, enableDebugLogging: boolean): Promise<void>;
/**
* Extract code for a scanned language using 'codeql database trace-command'
* and running the language extractor.
@ -637,7 +637,7 @@ export async function getCodeQLForCmd(
throw e;
}
},
async runAutobuild(language: Language) {
async runAutobuild(language: Language, enableDebugLogging: boolean) {
const autobuildCmd = path.join(
await this.resolveExtractor(language),
"tools",
@ -656,6 +656,12 @@ export async function getCodeQLForCmd(
"-Dmaven.wagon.http.pool=false",
].join(" ");
// Bump the verbosity of the autobuild command if we're in debug mode
if (enableDebugLogging) {
process.env[EnvVar.CLI_VERBOSITY] =
process.env[EnvVar.CLI_VERBOSITY] || EXTRACTION_DEBUG_MODE_VERBOSITY;
}
// On macOS, System Integrity Protection (SIP) typically interferes with
// CodeQL build tracing of protected binaries.
// The usual workaround is to prefix `$CODEQL_RUNNER` to build commands:

View file

@ -11,6 +11,12 @@ export enum EnvVar {
/** Whether the `autobuild` Action completes successfully. */
AUTOBUILD_DID_COMPLETE_SUCCESSFULLY = "CODEQL_ACTION_AUTOBUILD_DID_COMPLETE_SUCCESSFULLY",
/**
* The verbosity level of the CLI. One of the following: `errors`, `warnings`, `progress`,
* `progress+`, `progress++`, `progress+++`.
*/
CLI_VERBOSITY = "CODEQL_VERBOSITY",
/** Whether the CodeQL Action has invoked the Go autobuilder. */
DID_AUTOBUILD_GOLANG = "CODEQL_ACTION_DID_AUTOBUILD_GOLANG",