GHES 3.1 has been deprecated end of June 2022.
Therefore, we do not need to support the workaround for action telemetry anymore.
This commit is contained in:
parent
96c8872f06
commit
f3a27d6945
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.
|
* Returns whether sending the status report was successful of not.
|
||||||
*/
|
*/
|
||||||
async function sendStatusReport(statusReport) {
|
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);
|
const statusReportJSON = JSON.stringify(statusReport);
|
||||||
core.debug(`Sending status report: ${statusReportJSON}`);
|
core.debug(`Sending status report: ${statusReportJSON}`);
|
||||||
// If in test mode we don't want to upload the results
|
// 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 };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
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 = 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;
|
||||||
exports.isHostedRunner = void 0;
|
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const os = __importStar(require("os"));
|
const os = __importStar(require("os"));
|
||||||
const path = __importStar(require("path"));
|
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);
|
return (arg === null || arg === void 0 ? void 0 : arg.status) !== undefined && Number.isInteger(arg.status);
|
||||||
}
|
}
|
||||||
exports.isHTTPError = isHTTPError;
|
exports.isHTTPError = isHTTPError;
|
||||||
function isGitHubGhesVersionBelow(gitHubVersion, expectedVersion) {
|
|
||||||
return (gitHubVersion.type === GitHubVariant.GHES &&
|
|
||||||
semver.lt(gitHubVersion.version, expectedVersion));
|
|
||||||
}
|
|
||||||
exports.isGitHubGhesVersionBelow = isGitHubGhesVersionBelow;
|
|
||||||
let cachedCodeQlVersion = undefined;
|
let cachedCodeQlVersion = undefined;
|
||||||
function cacheCodeQlVersion(version) {
|
function cacheCodeQlVersion(version) {
|
||||||
if (cachedCodeQlVersion !== undefined) {
|
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) {
|
function formatGitHubVersion(version) {
|
||||||
switch (version.type) {
|
switch (version.type) {
|
||||||
case util.GitHubVariant.DOTCOM:
|
case util.GitHubVariant.DOTCOM:
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -16,7 +16,6 @@ import {
|
||||||
getCodeQLDatabasePath,
|
getCodeQLDatabasePath,
|
||||||
getRequiredEnvParam,
|
getRequiredEnvParam,
|
||||||
GITHUB_DOTCOM_URL,
|
GITHUB_DOTCOM_URL,
|
||||||
isGitHubGhesVersionBelow,
|
|
||||||
isHTTPError,
|
isHTTPError,
|
||||||
isInTestMode,
|
isInTestMode,
|
||||||
UserError,
|
UserError,
|
||||||
|
|
@ -749,14 +748,6 @@ const INCOMPATIBLE_MSG =
|
||||||
export async function sendStatusReport<S extends StatusReportBase>(
|
export async function sendStatusReport<S extends StatusReportBase>(
|
||||||
statusReport: S
|
statusReport: S
|
||||||
): Promise<boolean> {
|
): 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);
|
const statusReportJSON = JSON.stringify(statusReport);
|
||||||
core.debug(`Sending status report: ${statusReportJSON}`);
|
core.debug(`Sending status report: ${statusReportJSON}`);
|
||||||
// If in test mode we don't want to upload the results
|
// 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 {
|
function formatGitHubVersion(version: util.GitHubVersion): string {
|
||||||
switch (version.type) {
|
switch (version.type) {
|
||||||
case util.GitHubVariant.DOTCOM:
|
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);
|
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;
|
let cachedCodeQlVersion: undefined | string = undefined;
|
||||||
|
|
||||||
export function cacheCodeQlVersion(version: string): void {
|
export function cacheCodeQlVersion(version: string): void {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue