8000 Bump extraction verbosity in debug mode by henrymercer · Pull Request #2195 · github/codeql-action · GitHub
[go: up one dir, main page]

Skip to content

Bump extraction verbosity in debug mode #2195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Bump verbosity when running autobuild script directly in debug mode
  • Loading branch information
henrymercer committed Mar 13, 2024
commit 649f3e87e13f4f213f48e74290edc72fb40f76e5
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