Skip to content
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

Add some more configuration errors #2237

Merged
merged 2 commits into from
Apr 12, 2024
Merged
Changes from all commits
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
12 changes: 11 additions & 1 deletion lib/api-client.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/api-client.js.map

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

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
2 changes: 1 addition & 1 deletion lib/upload-lib.js
2 changes: 1 addition & 1 deletion lib/upload-lib.js.map

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions src/api-client.ts
Original file line number Diff line number Diff line change
@@ -5,10 +5,12 @@ import consoleLogLevel from "console-log-level";

import { getActionVersion, getRequiredInput } from "./actions-util";
import {
ConfigurationError,
getRequiredEnvParam,
GITHUB_DOTCOM_URL,
GitHubVariant,
GitHubVersion,
isHTTPError,
parseGitHubUrl,
parseMatrixInput,
} from "./util";
@@ -192,3 +194,15 @@ export function computeAutomationID(

return automationID;
}

export function wrapApiConfigurationError(e: unknown) {
if (isHTTPError(e)) {
if (
e.message.includes("API rate limit exceeded for site ID installation") ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only concern with this one is that we have a bug in the action where we are inadvertently causing rate limits for the repository. I feel like this has happened in the past.

Is this error for an org/user or is it specific to the repository/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the time the rate limit hits are legitimate, so this creates a level of noise that means we have a bunch of false positive monitor pings or have to raise our thresholds and miss genuine failures. My recommendation is we avoid the possibility of a bug in the Action as part of our monitoring for significant changes in configuration errors, which is intended to capture these errors that are noisy, but have signal in large numbers.

/^ref .* not found in this repository$/.test(e.message)
) {
return new ConfigurationError(e.message);
}
}
return e;
}
8 changes: 8 additions & 0 deletions src/cli-errors.ts
Original file line number Diff line number Diff line change
@@ -132,6 +132,7 @@ export enum CliConfigErrorCategory {
NoSupportedBuildCommandSucceeded = "NoSupportedBuildCommandSucceeded",
NoSupportedBuildSystemDetected = "NoSupportedBuildSystemDetected",
SwiftBuildFailed = "SwiftBuildFailed",
UnsupportedBuildMode = "UnsupportedBuildMode",
}

type CliErrorConfiguration = {
@@ -220,6 +221,13 @@ export const cliErrorsConfig: Record<
),
],
},
[CliConfigErrorCategory.UnsupportedBuildMode]: {
cliErrorMessageCandidates: [
new RegExp(
"does not support the .* build mode. Please try using one of the following build modes instead",
),
],
},
};

/**
4 changes: 2 additions & 2 deletions src/upload-lib.ts
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ import * as jsonschema from "jsonschema";
import * as actionsUtil from "./actions-util";
import { getOptionalInput, getRequiredInput } from "./actions-util";
import * as api from "./api-client";
import { getGitHubVersion } from "./api-client";
import { getGitHubVersion, wrapApiConfigurationError } from "./api-client";
import { CodeQL, getCodeQL } from "./codeql";
import { getConfig } from "./config-utils";
import { EnvVar } from "./environment";
@@ -256,7 +256,7 @@ async function uploadPayload(
break;
}
}
throw e;
throw wrapApiConfigurationError(e);
}
}