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

View file

@ -415,6 +415,7 @@ async function getCodeQLBundleDownloadURL(
* @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.
@ -425,13 +426,21 @@ export async function setupCodeQL(
apiDetails: api.GitHubApiDetails,
tempDir: string,
variant: util.GitHubVariant,
featureFlags: FeatureFlags,
logger: Logger,
checkVersion: boolean
): Promise<{ codeql: CodeQL; toolsVersion: string }> {
try {
// We use the special value of 'latest' to prioritize the version in the
// defaults over any pinned cached version.
const forceLatest = codeqlURL === "latest";
const forceLatest =
// We use the special value of 'latest' to prioritize the version in the
// defaults over any pinned cached version.
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(FeatureFlag.BypassToolcacheEnabled)));
if (forceLatest) {
codeqlURL = undefined;
}