Add a debug log message when forcing the latest tools

This commit is contained in:
Henry Mercer 2022-08-17 12:33:58 +01:00
parent 416ad3d847
commit f47f573e6e
3 changed files with 29 additions and 17 deletions

21
lib/codeql.js generated
View file

@ -226,17 +226,22 @@ async function getCodeQLBundleDownloadURL(apiDetails, variant, logger) {
*/ */
async function setupCodeQL(codeqlURL, apiDetails, tempDir, variant, featureFlags, logger, checkVersion) { async function setupCodeQL(codeqlURL, apiDetails, tempDir, variant, featureFlags, logger, checkVersion) {
try { try {
const forceLatest = const forceLatestReason =
// We use the special value of 'latest' to prioritize the version in the // We use the special value of 'latest' to prioritize the version in the
// defaults over any pinned cached version. // defaults over any pinned cached version.
codeqlURL === "latest" || codeqlURL === "latest"
// If the user hasn't requested a particular CodeQL version, then bypass ? '"tools: latest" was requested'
// the toolcache when the appropriate feature flag is enabled. This : // If the user hasn't requested a particular CodeQL version, then bypass
// allows us to quickly rollback a broken bundle that has made its way // the toolcache when the appropriate feature flag is enabled. This
// into the toolcache. // allows us to quickly rollback a broken bundle that has made its way
(codeqlURL === undefined && // into the toolcache.
(await featureFlags.getValue(feature_flags_1.FeatureFlag.BypassToolcacheEnabled))); codeqlURL === undefined &&
(await featureFlags.getValue(feature_flags_1.FeatureFlag.BypassToolcacheEnabled))
? "a specific version of CodeQL was not requested, and the bypass toolcache feature flag is enabled"
: undefined;
const forceLatest = forceLatestReason !== undefined;
if (forceLatest) { if (forceLatest) {
logger.debug(`Forcing the latest version of the CodeQL tools since ${forceLatestReason}.`);
codeqlURL = undefined; codeqlURL = undefined;
} }
let codeqlFolder; let codeqlFolder;

File diff suppressed because one or more lines are too long

View file

@ -431,17 +431,24 @@ export async function setupCodeQL(
checkVersion: boolean checkVersion: boolean
): Promise<{ codeql: CodeQL; toolsVersion: string }> { ): Promise<{ codeql: CodeQL; toolsVersion: string }> {
try { try {
const forceLatest = const forceLatestReason =
// We use the special value of 'latest' to prioritize the version in the // We use the special value of 'latest' to prioritize the version in the
// defaults over any pinned cached version. // defaults over any pinned cached version.
codeqlURL === "latest" || codeqlURL === "latest"
// If the user hasn't requested a particular CodeQL version, then bypass ? '"tools: latest" was requested'
// the toolcache when the appropriate feature flag is enabled. This : // If the user hasn't requested a particular CodeQL version, then bypass
// allows us to quickly rollback a broken bundle that has made its way // the toolcache when the appropriate feature flag is enabled. This
// into the toolcache. // allows us to quickly rollback a broken bundle that has made its way
(codeqlURL === undefined && // into the toolcache.
(await featureFlags.getValue(FeatureFlag.BypassToolcacheEnabled))); codeqlURL === undefined &&
(await featureFlags.getValue(FeatureFlag.BypassToolcacheEnabled))
? "a specific version of CodeQL was not requested, and the bypass toolcache feature flag is enabled"
: undefined;
const forceLatest = forceLatestReason !== undefined;
if (forceLatest) { if (forceLatest) {
logger.debug(
`Forcing the latest version of the CodeQL tools since ${forceLatestReason}.`
);
codeqlURL = undefined; codeqlURL = undefined;
} }
let codeqlFolder: string; let codeqlFolder: string;