Skip to content

Commit

Permalink
Merge pull request #2382 from github/angelapwen/make-autobuild-config…
Browse files Browse the repository at this point in the history
…-error

Classify autobuild errors as configuration errors
  • Loading branch information
angelapwen committed Jul 22, 2024
2 parents 44534b7 + b516521 commit ea8137f
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 6 deletions.
6 changes: 6 additions & 0 deletions lib/cli-errors.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/cli-errors.js.map

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

4 changes: 2 additions & 2 deletions lib/codeql.test.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.test.js.map

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions src/cli-errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ function ensureEndsInPeriod(text: string): string {

/** Error messages from the CLI that we consider configuration errors and handle specially. */
export enum CliConfigErrorCategory {
AutobuildError = "AutobuildError",
ExternalRepositoryCloneFailed = "ExternalRepositoryCloneFailed",
GradleBuildFailed = "GradleBuildFailed",
IncompatibleWithActionVersion = "IncompatibleWithActionVersion",
Expand Down Expand Up @@ -156,6 +157,11 @@ export const cliErrorsConfig: Record<
CliConfigErrorCategory,
CliErrorConfiguration
> = {
[CliConfigErrorCategory.AutobuildError]: {
cliErrorMessageCandidates: [
new RegExp("We were unable to automatically build your code"),
],
},
[CliConfigErrorCategory.ExternalRepositoryCloneFailed]: {
cliErrorMessageCandidates: [
new RegExp("Failed to clone external Git repository"),
Expand Down
4 changes: 2 additions & 2 deletions src/codeql.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ test("runTool summarizes autobuilder errors", async (t) => {
await t.throwsAsync(
async () => await codeqlObject.runAutobuild(stubConfig, Language.java),
{
instanceOf: CommandInvocationError,
instanceOf: util.ConfigurationError,
message:
"We were unable to automatically build your code. Please provide manual build steps. " +
"For more information, see " +
Expand Down Expand Up @@ -934,7 +934,7 @@ test("runTool truncates long autobuilder errors", async (t) => {
await t.throwsAsync(
async () => await codeqlObject.runAutobuild(stubConfig, Language.java),
{
instanceOf: CommandInvocationError,
instanceOf: util.ConfigurationError,
message:
"We were unable to automatically build your code. Please provide manual build steps. " +
"For more information, see " +
Expand Down

0 comments on commit ea8137f

Please sign in to comment.