Bypass toolcache when feature flag enabled

This commit is contained in:
Henry Mercer 2022-08-16 13:58:59 +01:00
parent df0c0dafc0
commit 5862bae77e
15 changed files with 65 additions and 27 deletions

12
lib/codeql.js generated
View file

@ -218,16 +218,24 @@ async function getCodeQLBundleDownloadURL(apiDetails, variant, logger) {
* @param apiDetails
* @param tempDir
* @param variant
* @param featureFlags
* @param logger
* @param checkVersion Whether to check that CodeQL CLI meets the minimum
* version requirement. Must be set to true outside tests.
* @returns
*/
async function setupCodeQL(codeqlURL, apiDetails, tempDir, variant, logger, checkVersion) {
async function setupCodeQL(codeqlURL, apiDetails, tempDir, variant, featureFlags, logger, checkVersion) {
try {
const forceLatest =
// We use the special value of 'latest' to prioritize the version in the
// defaults over any pinned cached version.
const forceLatest = codeqlURL === "latest";
codeqlURL === "latest" ||
// If the user hasn't requested a particular CodeQL version, then bypass
// the toolcache when the appropriate feature flag is enabled. This
// allows us to quickly rollback a broken bundle that has made its way
// into the toolcache.
(codeqlURL === undefined &&
(await featureFlags.getValue(feature_flags_1.FeatureFlag.BypassToolcacheEnabled)));
if (forceLatest) {
codeqlURL = undefined;
}