Soften deprecation message wording and remove unhelpful version strings from some locations
This commit is contained in:
parent
bcc13653e8
commit
df4819e3a1
6 changed files with 38 additions and 26 deletions
24
lib/setup-codeql.js
generated
24
lib/setup-codeql.js
generated
|
|
@ -226,7 +226,7 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian
|
|||
if (toolsInput &&
|
||||
!CODEQL_BUNDLE_VERSION_ALIAS.includes(toolsInput) &&
|
||||
!toolsInput.startsWith("http")) {
|
||||
logger.info("Using CodeQL CLI from local path $path");
|
||||
logger.info(`Using CodeQL CLI from local path ${toolsInput}`);
|
||||
return {
|
||||
codeqlTarPath: toolsInput,
|
||||
sourceType: "local",
|
||||
|
|
@ -249,7 +249,7 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian
|
|||
logger.info(`Overriding the version of the CodeQL tools by ${defaultCliVersion.cliVersion}, the version shipped with the Action since ` +
|
||||
`tools: ${toolsInput} was requested.`);
|
||||
if (toolsInput === "latest") {
|
||||
logger.warning("The 'latest' alias for the CodeQL tools has been deprecated. Please use 'linked' instead.");
|
||||
logger.warning("`tools: latest` has been renamed to `tools: linked`, but the old name is still supported for now. No action is required.");
|
||||
}
|
||||
}
|
||||
/** CLI version number, for example 2.12.6. */
|
||||
|
|
@ -340,12 +340,16 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian
|
|||
logger.info(`Did not find CodeQL tools version ${humanReadableVersion} in the toolcache.`);
|
||||
}
|
||||
if (codeqlFolder) {
|
||||
const version = cliVersion ?? humanReadableVersion;
|
||||
logger.info(`Using CodeQL CLI version ${version} from toolcache at ${codeqlFolder}`);
|
||||
if (cliVersion) {
|
||||
logger.info(`Using CodeQL CLI version ${cliVersion} from toolcache at ${codeqlFolder}`);
|
||||
}
|
||||
else {
|
||||
logger.info(`Using CodeQL CLI from toolcache at ${codeqlFolder}`);
|
||||
}
|
||||
return {
|
||||
codeqlFolder,
|
||||
sourceType: "toolcache",
|
||||
toolsVersion: version,
|
||||
toolsVersion: cliVersion ?? humanReadableVersion,
|
||||
};
|
||||
}
|
||||
// If we don't find the requested version on Enterprise, we may allow a
|
||||
|
|
@ -362,14 +366,18 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian
|
|||
if (!url) {
|
||||
url = await getCodeQLBundleDownloadURL(tagName, apiDetails, logger);
|
||||
}
|
||||
const toolsVersion = cliVersion ?? humanReadableVersion;
|
||||
logger.info(`Using CodeQL CLI version ${toolsVersion} downloaded from ${url}.`);
|
||||
if (cliVersion) {
|
||||
logger.info(`Using CodeQL CLI version ${cliVersion} sourced from ${url}.`);
|
||||
}
|
||||
else {
|
||||
logger.info(`Using CodeQL CLI sourced from ${url}.`);
|
||||
}
|
||||
return {
|
||||
bundleVersion: tagName && tryGetBundleVersionFromTagName(tagName, logger),
|
||||
cliVersion,
|
||||
codeqlURL: url,
|
||||
sourceType: "download",
|
||||
toolsVersion,
|
||||
toolsVersion: cliVersion ?? humanReadableVersion,
|
||||
};
|
||||
}
|
||||
exports.getCodeQLSource = getCodeQLSource;
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
4
lib/setup-codeql.test.js
generated
4
lib/setup-codeql.test.js
generated
|
|
@ -103,7 +103,7 @@ ava_1.default.beforeEach(() => {
|
|||
t.is(source.toolsVersion, testing_utils_1.LINKED_CLI_VERSION.cliVersion);
|
||||
t.is(source.sourceType, "download");
|
||||
// Afterwards, ensure that we see the deprecation message in the log.
|
||||
const expected_message = "The 'latest' alias for the CodeQL tools has been deprecated. Please use 'linked' instead.";
|
||||
const expected_message = "`tools: latest` has been renamed to `tools: linked`, but the old name is still supported for now. No action is required.";
|
||||
t.assert(loggedMessages.some((msg) => typeof msg.message === "string" &&
|
||||
msg.message.includes(expected_message)));
|
||||
});
|
||||
|
|
@ -149,7 +149,7 @@ ava_1.default.beforeEach(() => {
|
|||
// bundle contains..
|
||||
t.is(result.toolsVersion, expectedVersion);
|
||||
// Ensure message logging CodeQL CLI version was present in user logs.
|
||||
const expected_message = `Using CodeQL CLI version 2.16.0 downloaded from ${bundleUrl}.`;
|
||||
const expected_message = `Using CodeQL CLI version 2.16.0 sourced from ${bundleUrl}.`;
|
||||
t.assert(loggedMessages.some((msg) => typeof msg.message === "string" &&
|
||||
msg.message.includes(expected_message)));
|
||||
});
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -134,7 +134,7 @@ test("getCodeQLSource correctly returns bundled CLI version when tools == latest
|
|||
|
||||
// Afterwards, ensure that we see the deprecation message in the log.
|
||||
const expected_message: string =
|
||||
"The 'latest' alias for the CodeQL tools has been deprecated. Please use 'linked' instead.";
|
||||
"`tools: latest` has been renamed to `tools: linked`, but the old name is still supported for now. No action is required.";
|
||||
t.assert(
|
||||
loggedMessages.some(
|
||||
(msg) =>
|
||||
|
|
@ -216,7 +216,7 @@ test("setupCodeQLBundle logs the CodeQL CLI version being used when asked to dow
|
|||
t.is(result.toolsVersion, expectedVersion);
|
||||
|
||||
// Ensure message logging CodeQL CLI version was present in user logs.
|
||||
const expected_message: string = `Using CodeQL CLI version 2.16.0 downloaded from ${bundleUrl}.`;
|
||||
const expected_message: string = `Using CodeQL CLI version 2.16.0 sourced from ${bundleUrl}.`;
|
||||
t.assert(
|
||||
loggedMessages.some(
|
||||
(msg) =>
|
||||
|
|
|
|||
|
|
@ -288,7 +288,7 @@ export async function getCodeQLSource(
|
|||
!CODEQL_BUNDLE_VERSION_ALIAS.includes(toolsInput) &&
|
||||
!toolsInput.startsWith("http")
|
||||
) {
|
||||
logger.info("Using CodeQL CLI from local path $path");
|
||||
logger.info(`Using CodeQL CLI from local path ${toolsInput}`);
|
||||
return {
|
||||
codeqlTarPath: toolsInput,
|
||||
sourceType: "local",
|
||||
|
|
@ -317,7 +317,7 @@ export async function getCodeQLSource(
|
|||
|
||||
if (toolsInput === "latest") {
|
||||
logger.warning(
|
||||
"The 'latest' alias for the CodeQL tools has been deprecated. Please use 'linked' instead.",
|
||||
"`tools: latest` has been renamed to `tools: linked`, but the old name is still supported for now. No action is required.",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -442,14 +442,17 @@ export async function getCodeQLSource(
|
|||
}
|
||||
|
||||
if (codeqlFolder) {
|
||||
const version = cliVersion ?? humanReadableVersion;
|
||||
logger.info(
|
||||
`Using CodeQL CLI version ${version} from toolcache at ${codeqlFolder}`,
|
||||
);
|
||||
if (cliVersion) {
|
||||
logger.info(
|
||||
`Using CodeQL CLI version ${cliVersion} from toolcache at ${codeqlFolder}`,
|
||||
);
|
||||
} else {
|
||||
logger.info(`Using CodeQL CLI from toolcache at ${codeqlFolder}`);
|
||||
}
|
||||
return {
|
||||
codeqlFolder,
|
||||
sourceType: "toolcache",
|
||||
toolsVersion: version,
|
||||
toolsVersion: cliVersion ?? humanReadableVersion,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -474,16 +477,17 @@ export async function getCodeQLSource(
|
|||
url = await getCodeQLBundleDownloadURL(tagName!, apiDetails, logger);
|
||||
}
|
||||
|
||||
const toolsVersion = cliVersion ?? humanReadableVersion;
|
||||
logger.info(
|
||||
`Using CodeQL CLI version ${toolsVersion} downloaded from ${url}.`,
|
||||
);
|
||||
if (cliVersion) {
|
||||
logger.info(`Using CodeQL CLI version ${cliVersion} sourced from ${url}.`);
|
||||
} else {
|
||||
logger.info(`Using CodeQL CLI sourced from ${url}.`);
|
||||
}
|
||||
return {
|
||||
bundleVersion: tagName && tryGetBundleVersionFromTagName(tagName, logger),
|
||||
cliVersion,
|
||||
codeqlURL: url,
|
||||
sourceType: "download",
|
||||
toolsVersion,
|
||||
toolsVersion: cliVersion ?? humanReadableVersion,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue