Skip to content

Commit

Permalink
Bump verbosity when running autobuild script directly in debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry Mercer committed Mar 13, 2024
1 parent 362c407 commit 649f3e8
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/autobuild.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/autobuild.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion lib/codeql.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/codeql.js.map

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions lib/environment.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/environment.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/autobuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
10 changes: 8 additions & 2 deletions src/codeql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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",
Expand All @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions src/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",

Expand Down

0 comments on commit 649f3e8

Please sign in to comment.