Add option tools: linked for init action.
Also ensure that option latest remains compatible, and add tests for the two options.
This commit is contained in:
parent
bf2faab135
commit
cbe408dfc9
9 changed files with 101 additions and 12 deletions
15
lib/setup-codeql.js
generated
15
lib/setup-codeql.js
generated
|
|
@ -52,6 +52,7 @@ var ToolsSource;
|
|||
ToolsSource["Download"] = "DOWNLOAD";
|
||||
})(ToolsSource || (exports.ToolsSource = ToolsSource = {}));
|
||||
exports.CODEQL_DEFAULT_ACTION_REPOSITORY = "github/codeql-action";
|
||||
const CODEQL_BUNDLE_VERSION_ALIAS = ["linked", "latest"];
|
||||
function getCodeQLBundleName() {
|
||||
let platform;
|
||||
if (process.platform === "win32") {
|
||||
|
|
@ -222,7 +223,9 @@ async function findOverridingToolsInCache(humanReadableVersion, logger) {
|
|||
return undefined;
|
||||
}
|
||||
async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, variant, logger) {
|
||||
if (toolsInput && toolsInput !== "latest" && !toolsInput.startsWith("http")) {
|
||||
if (toolsInput &&
|
||||
!CODEQL_BUNDLE_VERSION_ALIAS.includes(toolsInput) &&
|
||||
!toolsInput.startsWith("http")) {
|
||||
return {
|
||||
codeqlTarPath: toolsInput,
|
||||
sourceType: "local",
|
||||
|
|
@ -232,14 +235,18 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian
|
|||
/**
|
||||
* Whether the tools shipped with the Action, i.e. those in `defaults.json`, have been forced.
|
||||
*
|
||||
* We use the special value of 'latest' to prioritize the version in `defaults.json` over the
|
||||
* We use the special value of 'linked' to prioritize the version in `defaults.json` over the
|
||||
* version specified by the feature flags on Dotcom and over any pinned cached version on
|
||||
* Enterprise Server.
|
||||
*
|
||||
* Previously we have been using 'latest' to force the shipped tools, but this was not clear
|
||||
* enough for the users, so it has been changed to `linked`. We're keeping around `latest` for
|
||||
* backwards compatibility.
|
||||
*/
|
||||
const forceShippedTools = toolsInput === "latest";
|
||||
const forceShippedTools = toolsInput && CODEQL_BUNDLE_VERSION_ALIAS.includes(toolsInput);
|
||||
if (forceShippedTools) {
|
||||
logger.info("Overriding the version of the CodeQL tools by the version shipped with the Action since " +
|
||||
`"tools: latest" was requested.`);
|
||||
`"tools: linked" or "tools: latest" was requested.`);
|
||||
}
|
||||
/** CLI version number, for example 2.12.6. */
|
||||
let cliVersion;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue