Merge pull request #1313 from github/criemen/ghes-31-deprecation
GHES 3.1 has been deprecated end of June 2022.
This commit is contained in:
commit
3920e2d8ae
9 changed files with 4 additions and 70 deletions
7
lib/actions-util.js
generated
7
lib/actions-util.js
generated
|
|
@ -563,13 +563,6 @@ const INCOMPATIBLE_MSG = "CodeQL Action version is incompatible with the code sc
|
|||
* Returns whether sending the status report was successful of not.
|
||||
*/
|
||||
async function sendStatusReport(statusReport) {
|
||||
const gitHubVersion = await api.getGitHubVersionActionsOnly();
|
||||
if ((0, util_1.isGitHubGhesVersionBelow)(gitHubVersion, "3.2.0")) {
|
||||
// GHES 3.1 and earlier versions reject unexpected properties, which means
|
||||
// that they will reject status reports with newly added properties.
|
||||
// Inhibiting status reporting for GHES < 3.2 avoids such failures.
|
||||
return true;
|
||||
}
|
||||
const statusReportJSON = JSON.stringify(statusReport);
|
||||
core.debug(`Sending status report: ${statusReportJSON}`);
|
||||
// If in test mode we don't want to upload the results
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
8
lib/util.js
generated
8
lib/util.js
generated
|
|
@ -22,8 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.withTimeout = exports.tryGetFolderBytes = exports.isGoExtractionReconciliationEnabled = exports.listFolder = exports.doesDirectoryExist = exports.logCodeScanningConfigInCli = exports.useCodeScanningConfigInCli = exports.isInTestMode = exports.checkActionVersion = exports.getMlPoweredJsQueriesStatus = exports.getMlPoweredJsQueriesPack = exports.ML_POWERED_JS_QUERIES_PACK_NAME = exports.isGoodVersion = exports.delay = exports.bundleDb = exports.codeQlVersionAbove = exports.getCachedCodeQlVersion = exports.cacheCodeQlVersion = exports.isGitHubGhesVersionBelow = exports.isHTTPError = exports.UserError = exports.HTTPError = exports.getRequiredEnvParam = exports.isActions = exports.getMode = exports.enrichEnvironment = exports.initializeEnvironment = exports.EnvVar = exports.Mode = exports.assertNever = exports.getGitHubAuth = exports.apiVersionInRange = exports.DisallowedAPIVersionReason = exports.checkGitHubVersionInRange = exports.getGitHubVersion = exports.GitHubVariant = exports.parseGitHubUrl = exports.getCodeQLDatabasePath = exports.getThreadsFlag = exports.getThreadsFlagValue = exports.getAddSnippetsFlag = exports.getMemoryFlag = exports.getMemoryFlagValue = exports.withTmpDir = exports.getToolNames = exports.getExtraOptionsEnvParam = exports.DID_AUTOBUILD_GO_ENV_VAR_NAME = exports.DEFAULT_DEBUG_DATABASE_NAME = exports.DEFAULT_DEBUG_ARTIFACT_NAME = exports.GITHUB_DOTCOM_URL = void 0;
|
||||
exports.isHostedRunner = void 0;
|
||||
exports.isHostedRunner = exports.withTimeout = exports.tryGetFolderBytes = exports.isGoExtractionReconciliationEnabled = exports.listFolder = exports.doesDirectoryExist = exports.logCodeScanningConfigInCli = exports.useCodeScanningConfigInCli = exports.isInTestMode = exports.checkActionVersion = exports.getMlPoweredJsQueriesStatus = exports.getMlPoweredJsQueriesPack = exports.ML_POWERED_JS_QUERIES_PACK_NAME = exports.isGoodVersion = exports.delay = exports.bundleDb = exports.codeQlVersionAbove = exports.getCachedCodeQlVersion = exports.cacheCodeQlVersion = exports.isHTTPError = exports.UserError = exports.HTTPError = exports.getRequiredEnvParam = exports.isActions = exports.getMode = exports.enrichEnvironment = exports.initializeEnvironment = exports.EnvVar = exports.Mode = exports.assertNever = exports.getGitHubAuth = exports.apiVersionInRange = exports.DisallowedAPIVersionReason = exports.checkGitHubVersionInRange = exports.getGitHubVersion = exports.GitHubVariant = exports.parseGitHubUrl = exports.getCodeQLDatabasePath = exports.getThreadsFlag = exports.getThreadsFlagValue = exports.getAddSnippetsFlag = exports.getMemoryFlag = exports.getMemoryFlagValue = exports.withTmpDir = exports.getToolNames = exports.getExtraOptionsEnvParam = exports.DID_AUTOBUILD_GO_ENV_VAR_NAME = exports.DEFAULT_DEBUG_DATABASE_NAME = exports.DEFAULT_DEBUG_ARTIFACT_NAME = exports.GITHUB_DOTCOM_URL = void 0;
|
||||
const fs = __importStar(require("fs"));
|
||||
const os = __importStar(require("os"));
|
||||
const path = __importStar(require("path"));
|
||||
|
|
@ -507,11 +506,6 @@ function isHTTPError(arg) {
|
|||
return (arg === null || arg === void 0 ? void 0 : arg.status) !== undefined && Number.isInteger(arg.status);
|
||||
}
|
||||
exports.isHTTPError = isHTTPError;
|
||||
function isGitHubGhesVersionBelow(gitHubVersion, expectedVersion) {
|
||||
return (gitHubVersion.type === GitHubVariant.GHES &&
|
||||
semver.lt(gitHubVersion.version, expectedVersion));
|
||||
}
|
||||
exports.isGitHubGhesVersionBelow = isGitHubGhesVersionBelow;
|
||||
let cachedCodeQlVersion = undefined;
|
||||
function cacheCodeQlVersion(version) {
|
||||
if (cachedCodeQlVersion !== undefined) {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
7
lib/util.test.js
generated
7
lib/util.test.js
generated
|
|
@ -273,13 +273,6 @@ for (const [packs, expectedStatus] of ML_POWERED_JS_STATUS_TESTS) {
|
|||
});
|
||||
});
|
||||
}
|
||||
(0, ava_1.default)("isGitHubGhesVersionBelow", async (t) => {
|
||||
t.falsy(util.isGitHubGhesVersionBelow({ type: util.GitHubVariant.DOTCOM }, "3.2.0"));
|
||||
t.falsy(util.isGitHubGhesVersionBelow({ type: util.GitHubVariant.GHAE }, "3.2.0"));
|
||||
t.falsy(util.isGitHubGhesVersionBelow({ type: util.GitHubVariant.GHES, version: "3.3.0" }, "3.2.0"));
|
||||
t.falsy(util.isGitHubGhesVersionBelow({ type: util.GitHubVariant.GHES, version: "3.2.0" }, "3.2.0"));
|
||||
t.true(util.isGitHubGhesVersionBelow({ type: util.GitHubVariant.GHES, version: "3.1.2" }, "3.2.0"));
|
||||
});
|
||||
function formatGitHubVersion(version) {
|
||||
switch (version.type) {
|
||||
case util.GitHubVariant.DOTCOM:
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -16,7 +16,6 @@ import {
|
|||
getCodeQLDatabasePath,
|
||||
getRequiredEnvParam,
|
||||
GITHUB_DOTCOM_URL,
|
||||
isGitHubGhesVersionBelow,
|
||||
isHTTPError,
|
||||
isInTestMode,
|
||||
UserError,
|
||||
|
|
@ -749,14 +748,6 @@ const INCOMPATIBLE_MSG =
|
|||
export async function sendStatusReport<S extends StatusReportBase>(
|
||||
statusReport: S
|
||||
): Promise<boolean> {
|
||||
const gitHubVersion = await api.getGitHubVersionActionsOnly();
|
||||
if (isGitHubGhesVersionBelow(gitHubVersion, "3.2.0")) {
|
||||
// GHES 3.1 and earlier versions reject unexpected properties, which means
|
||||
// that they will reject status reports with newly added properties.
|
||||
// Inhibiting status reporting for GHES < 3.2 avoids such failures.
|
||||
return true;
|
||||
}
|
||||
|
||||
const statusReportJSON = JSON.stringify(statusReport);
|
||||
core.debug(`Sending status report: ${statusReportJSON}`);
|
||||
// If in test mode we don't want to upload the results
|
||||
|
|
|
|||
|
|
@ -365,33 +365,6 @@ for (const [packs, expectedStatus] of ML_POWERED_JS_STATUS_TESTS) {
|
|||
});
|
||||
}
|
||||
|
||||
test("isGitHubGhesVersionBelow", async (t) => {
|
||||
t.falsy(
|
||||
util.isGitHubGhesVersionBelow({ type: util.GitHubVariant.DOTCOM }, "3.2.0")
|
||||
);
|
||||
t.falsy(
|
||||
util.isGitHubGhesVersionBelow({ type: util.GitHubVariant.GHAE }, "3.2.0")
|
||||
);
|
||||
t.falsy(
|
||||
util.isGitHubGhesVersionBelow(
|
||||
{ type: util.GitHubVariant.GHES, version: "3.3.0" },
|
||||
"3.2.0"
|
||||
)
|
||||
);
|
||||
t.falsy(
|
||||
util.isGitHubGhesVersionBelow(
|
||||
{ type: util.GitHubVariant.GHES, version: "3.2.0" },
|
||||
"3.2.0"
|
||||
)
|
||||
);
|
||||
t.true(
|
||||
util.isGitHubGhesVersionBelow(
|
||||
{ type: util.GitHubVariant.GHES, version: "3.1.2" },
|
||||
"3.2.0"
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
function formatGitHubVersion(version: util.GitHubVersion): string {
|
||||
switch (version.type) {
|
||||
case util.GitHubVariant.DOTCOM:
|
||||
|
|
|
|||
10
src/util.ts
10
src/util.ts
|
|
@ -605,16 +605,6 @@ export function isHTTPError(arg: any): arg is HTTPError {
|
|||
return arg?.status !== undefined && Number.isInteger(arg.status);
|
||||
}
|
||||
|
||||
export function isGitHubGhesVersionBelow(
|
||||
gitHubVersion: GitHubVersion,
|
||||
expectedVersion: string
|
||||
): boolean {
|
||||
return (
|
||||
gitHubVersion.type === GitHubVariant.GHES &&
|
||||
semver.lt(gitHubVersion.version, expectedVersion)
|
||||
);
|
||||
}
|
||||
|
||||
let cachedCodeQlVersion: undefined | string = undefined;
|
||||
|
||||
export function cacheCodeQlVersion(version: string): void {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue