mirror of
https://github.com/github/codeql-action.git
synced 2025-12-23 15:50:11 +08:00
Gate tools: toolcache behind FF
Mainly to allow us to disable it, if needed.
This commit is contained in:
29
lib/analyze-action.js
generated
29
lib/analyze-action.js
generated
@@ -92304,7 +92304,7 @@ async function findOverridingToolsInCache(humanReadableVersion, logger) {
|
|||||||
}
|
}
|
||||||
return void 0;
|
return void 0;
|
||||||
}
|
}
|
||||||
async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, variant, tarSupportsZstd, logger) {
|
async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, variant, tarSupportsZstd, features, logger) {
|
||||||
if (toolsInput && !isReservedToolsValue(toolsInput) && !toolsInput.startsWith("http")) {
|
if (toolsInput && !isReservedToolsValue(toolsInput) && !toolsInput.startsWith("http")) {
|
||||||
logger.info(`Using CodeQL CLI from local path ${toolsInput}`);
|
logger.info(`Using CodeQL CLI from local path ${toolsInput}`);
|
||||||
const compressionMethod2 = inferCompressionMethod(toolsInput);
|
const compressionMethod2 = inferCompressionMethod(toolsInput);
|
||||||
@@ -92343,7 +92343,10 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian
|
|||||||
}
|
}
|
||||||
} else if (toolsInput !== void 0 && toolsInput === CODEQL_TOOLCACHE_INPUT) {
|
} else if (toolsInput !== void 0 && toolsInput === CODEQL_TOOLCACHE_INPUT) {
|
||||||
let latestToolcacheVersion;
|
let latestToolcacheVersion;
|
||||||
const allowToolcacheValue = isDynamicWorkflow() || isInTestMode();
|
const allowToolcacheValueFF = await features.getValue(
|
||||||
|
"allow_toolcache_input" /* AllowToolcacheInput */
|
||||||
|
);
|
||||||
|
const allowToolcacheValue = allowToolcacheValueFF && (isDynamicWorkflow() || isInTestMode());
|
||||||
if (allowToolcacheValue) {
|
if (allowToolcacheValue) {
|
||||||
logger.info(
|
logger.info(
|
||||||
`Attempting to use the latest CodeQL CLI version in the toolcache, as requested by 'tools: ${toolsInput}'.`
|
`Attempting to use the latest CodeQL CLI version in the toolcache, as requested by 'tools: ${toolsInput}'.`
|
||||||
@@ -92359,9 +92362,15 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian
|
|||||||
`Found no CodeQL CLI in the toolcache, ignoring 'tools: ${toolsInput}'...`
|
`Found no CodeQL CLI in the toolcache, ignoring 'tools: ${toolsInput}'...`
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
logger.warning(
|
if (allowToolcacheValueFF) {
|
||||||
`Ignoring 'tools: ${toolsInput}' because the workflow was not triggered dynamically.`
|
logger.info(
|
||||||
);
|
`Ignoring 'tools: ${toolsInput}' because the feature is not enabled.`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
logger.warning(
|
||||||
|
`Ignoring 'tools: ${toolsInput}' because the workflow was not triggered dynamically.`
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cliVersion2 = defaultCliVersion.cliVersion;
|
cliVersion2 = defaultCliVersion.cliVersion;
|
||||||
tagName = defaultCliVersion.tagName;
|
tagName = defaultCliVersion.tagName;
|
||||||
@@ -92574,7 +92583,7 @@ function getCanonicalToolcacheVersion(cliVersion2, bundleVersion2, logger) {
|
|||||||
}
|
}
|
||||||
return cliVersion2;
|
return cliVersion2;
|
||||||
}
|
}
|
||||||
async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger) {
|
async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, features, logger) {
|
||||||
if (!await isBinaryAccessible("tar", logger)) {
|
if (!await isBinaryAccessible("tar", logger)) {
|
||||||
throw new ConfigurationError(
|
throw new ConfigurationError(
|
||||||
"Could not find tar in PATH, so unable to extract CodeQL bundle."
|
"Could not find tar in PATH, so unable to extract CodeQL bundle."
|
||||||
@@ -92587,6 +92596,7 @@ async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defau
|
|||||||
apiDetails,
|
apiDetails,
|
||||||
variant,
|
variant,
|
||||||
zstdAvailability.available,
|
zstdAvailability.available,
|
||||||
|
features,
|
||||||
logger
|
logger
|
||||||
);
|
);
|
||||||
let codeqlFolder;
|
let codeqlFolder;
|
||||||
@@ -92744,7 +92754,7 @@ var GHES_VERSION_MOST_RECENTLY_DEPRECATED = "3.13";
|
|||||||
var GHES_MOST_RECENT_DEPRECATION_DATE = "2025-06-19";
|
var GHES_MOST_RECENT_DEPRECATION_DATE = "2025-06-19";
|
||||||
var EXTRACTION_DEBUG_MODE_VERBOSITY = "progress++";
|
var EXTRACTION_DEBUG_MODE_VERBOSITY = "progress++";
|
||||||
var CODEQL_VERSION_CACHE_CLEANUP = "2.17.1";
|
var CODEQL_VERSION_CACHE_CLEANUP = "2.17.1";
|
||||||
async function setupCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger, checkVersion) {
|
async function setupCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, features, logger, checkVersion) {
|
||||||
try {
|
try {
|
||||||
const {
|
const {
|
||||||
codeqlFolder,
|
codeqlFolder,
|
||||||
@@ -92758,6 +92768,7 @@ async function setupCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliV
|
|||||||
tempDir,
|
tempDir,
|
||||||
variant,
|
variant,
|
||||||
defaultCliVersion,
|
defaultCliVersion,
|
||||||
|
features,
|
||||||
logger
|
logger
|
||||||
);
|
);
|
||||||
logger.debug(
|
logger.debug(
|
||||||
@@ -95409,7 +95420,7 @@ async function addFingerprints(sarif, sourceRoot, logger) {
|
|||||||
// src/init.ts
|
// src/init.ts
|
||||||
var toolrunner4 = __toESM(require_toolrunner());
|
var toolrunner4 = __toESM(require_toolrunner());
|
||||||
var io6 = __toESM(require_io());
|
var io6 = __toESM(require_io());
|
||||||
async function initCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger) {
|
async function initCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, features, logger) {
|
||||||
logger.startGroup("Setup CodeQL tools");
|
logger.startGroup("Setup CodeQL tools");
|
||||||
const {
|
const {
|
||||||
codeql,
|
codeql,
|
||||||
@@ -95423,6 +95434,7 @@ async function initCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVe
|
|||||||
tempDir,
|
tempDir,
|
||||||
variant,
|
variant,
|
||||||
defaultCliVersion,
|
defaultCliVersion,
|
||||||
|
features,
|
||||||
logger,
|
logger,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
@@ -95569,6 +95581,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
|
|||||||
tempDir,
|
tempDir,
|
||||||
gitHubVersion.type,
|
gitHubVersion.type,
|
||||||
codeQLDefaultVersionInfo,
|
codeQLDefaultVersionInfo,
|
||||||
|
features,
|
||||||
logger
|
logger
|
||||||
);
|
);
|
||||||
codeQL = initCodeQLResult.codeql;
|
codeQL = initCodeQLResult.codeql;
|
||||||
|
|||||||
29
lib/init-action-post.js
generated
29
lib/init-action-post.js
generated
@@ -130286,7 +130286,7 @@ async function findOverridingToolsInCache(humanReadableVersion, logger) {
|
|||||||
}
|
}
|
||||||
return void 0;
|
return void 0;
|
||||||
}
|
}
|
||||||
async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, variant, tarSupportsZstd, logger) {
|
async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, variant, tarSupportsZstd, features, logger) {
|
||||||
if (toolsInput && !isReservedToolsValue(toolsInput) && !toolsInput.startsWith("http")) {
|
if (toolsInput && !isReservedToolsValue(toolsInput) && !toolsInput.startsWith("http")) {
|
||||||
logger.info(`Using CodeQL CLI from local path ${toolsInput}`);
|
logger.info(`Using CodeQL CLI from local path ${toolsInput}`);
|
||||||
const compressionMethod2 = inferCompressionMethod(toolsInput);
|
const compressionMethod2 = inferCompressionMethod(toolsInput);
|
||||||
@@ -130325,7 +130325,10 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian
|
|||||||
}
|
}
|
||||||
} else if (toolsInput !== void 0 && toolsInput === CODEQL_TOOLCACHE_INPUT) {
|
} else if (toolsInput !== void 0 && toolsInput === CODEQL_TOOLCACHE_INPUT) {
|
||||||
let latestToolcacheVersion;
|
let latestToolcacheVersion;
|
||||||
const allowToolcacheValue = isDynamicWorkflow() || isInTestMode();
|
const allowToolcacheValueFF = await features.getValue(
|
||||||
|
"allow_toolcache_input" /* AllowToolcacheInput */
|
||||||
|
);
|
||||||
|
const allowToolcacheValue = allowToolcacheValueFF && (isDynamicWorkflow() || isInTestMode());
|
||||||
if (allowToolcacheValue) {
|
if (allowToolcacheValue) {
|
||||||
logger.info(
|
logger.info(
|
||||||
`Attempting to use the latest CodeQL CLI version in the toolcache, as requested by 'tools: ${toolsInput}'.`
|
`Attempting to use the latest CodeQL CLI version in the toolcache, as requested by 'tools: ${toolsInput}'.`
|
||||||
@@ -130341,9 +130344,15 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian
|
|||||||
`Found no CodeQL CLI in the toolcache, ignoring 'tools: ${toolsInput}'...`
|
`Found no CodeQL CLI in the toolcache, ignoring 'tools: ${toolsInput}'...`
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
logger.warning(
|
if (allowToolcacheValueFF) {
|
||||||
`Ignoring 'tools: ${toolsInput}' because the workflow was not triggered dynamically.`
|
logger.info(
|
||||||
);
|
`Ignoring 'tools: ${toolsInput}' because the feature is not enabled.`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
logger.warning(
|
||||||
|
`Ignoring 'tools: ${toolsInput}' because the workflow was not triggered dynamically.`
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cliVersion2 = defaultCliVersion.cliVersion;
|
cliVersion2 = defaultCliVersion.cliVersion;
|
||||||
tagName = defaultCliVersion.tagName;
|
tagName = defaultCliVersion.tagName;
|
||||||
@@ -130556,7 +130565,7 @@ function getCanonicalToolcacheVersion(cliVersion2, bundleVersion2, logger) {
|
|||||||
}
|
}
|
||||||
return cliVersion2;
|
return cliVersion2;
|
||||||
}
|
}
|
||||||
async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger) {
|
async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, features, logger) {
|
||||||
if (!await isBinaryAccessible("tar", logger)) {
|
if (!await isBinaryAccessible("tar", logger)) {
|
||||||
throw new ConfigurationError(
|
throw new ConfigurationError(
|
||||||
"Could not find tar in PATH, so unable to extract CodeQL bundle."
|
"Could not find tar in PATH, so unable to extract CodeQL bundle."
|
||||||
@@ -130569,6 +130578,7 @@ async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defau
|
|||||||
apiDetails,
|
apiDetails,
|
||||||
variant,
|
variant,
|
||||||
zstdAvailability.available,
|
zstdAvailability.available,
|
||||||
|
features,
|
||||||
logger
|
logger
|
||||||
);
|
);
|
||||||
let codeqlFolder;
|
let codeqlFolder;
|
||||||
@@ -130693,7 +130703,7 @@ var GHES_VERSION_MOST_RECENTLY_DEPRECATED = "3.13";
|
|||||||
var GHES_MOST_RECENT_DEPRECATION_DATE = "2025-06-19";
|
var GHES_MOST_RECENT_DEPRECATION_DATE = "2025-06-19";
|
||||||
var EXTRACTION_DEBUG_MODE_VERBOSITY = "progress++";
|
var EXTRACTION_DEBUG_MODE_VERBOSITY = "progress++";
|
||||||
var CODEQL_VERSION_CACHE_CLEANUP = "2.17.1";
|
var CODEQL_VERSION_CACHE_CLEANUP = "2.17.1";
|
||||||
async function setupCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger, checkVersion) {
|
async function setupCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, features, logger, checkVersion) {
|
||||||
try {
|
try {
|
||||||
const {
|
const {
|
||||||
codeqlFolder,
|
codeqlFolder,
|
||||||
@@ -130707,6 +130717,7 @@ async function setupCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliV
|
|||||||
tempDir,
|
tempDir,
|
||||||
variant,
|
variant,
|
||||||
defaultCliVersion,
|
defaultCliVersion,
|
||||||
|
features,
|
||||||
logger
|
logger
|
||||||
);
|
);
|
||||||
logger.debug(
|
logger.debug(
|
||||||
@@ -132885,7 +132896,7 @@ async function addFingerprints(sarif, sourceRoot, logger) {
|
|||||||
// src/init.ts
|
// src/init.ts
|
||||||
var toolrunner4 = __toESM(require_toolrunner());
|
var toolrunner4 = __toESM(require_toolrunner());
|
||||||
var io6 = __toESM(require_io());
|
var io6 = __toESM(require_io());
|
||||||
async function initCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger) {
|
async function initCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, features, logger) {
|
||||||
logger.startGroup("Setup CodeQL tools");
|
logger.startGroup("Setup CodeQL tools");
|
||||||
const {
|
const {
|
||||||
codeql,
|
codeql,
|
||||||
@@ -132899,6 +132910,7 @@ async function initCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVe
|
|||||||
tempDir,
|
tempDir,
|
||||||
variant,
|
variant,
|
||||||
defaultCliVersion,
|
defaultCliVersion,
|
||||||
|
features,
|
||||||
logger,
|
logger,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
@@ -133045,6 +133057,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
|
|||||||
tempDir,
|
tempDir,
|
||||||
gitHubVersion.type,
|
gitHubVersion.type,
|
||||||
codeQLDefaultVersionInfo,
|
codeQLDefaultVersionInfo,
|
||||||
|
features,
|
||||||
logger
|
logger
|
||||||
);
|
);
|
||||||
codeQL = initCodeQLResult.codeql;
|
codeQL = initCodeQLResult.codeql;
|
||||||
|
|||||||
29
lib/init-action.js
generated
29
lib/init-action.js
generated
@@ -89082,7 +89082,7 @@ async function findOverridingToolsInCache(humanReadableVersion, logger) {
|
|||||||
}
|
}
|
||||||
return void 0;
|
return void 0;
|
||||||
}
|
}
|
||||||
async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, variant, tarSupportsZstd, logger) {
|
async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, variant, tarSupportsZstd, features, logger) {
|
||||||
if (toolsInput && !isReservedToolsValue(toolsInput) && !toolsInput.startsWith("http")) {
|
if (toolsInput && !isReservedToolsValue(toolsInput) && !toolsInput.startsWith("http")) {
|
||||||
logger.info(`Using CodeQL CLI from local path ${toolsInput}`);
|
logger.info(`Using CodeQL CLI from local path ${toolsInput}`);
|
||||||
const compressionMethod2 = inferCompressionMethod(toolsInput);
|
const compressionMethod2 = inferCompressionMethod(toolsInput);
|
||||||
@@ -89121,7 +89121,10 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian
|
|||||||
}
|
}
|
||||||
} else if (toolsInput !== void 0 && toolsInput === CODEQL_TOOLCACHE_INPUT) {
|
} else if (toolsInput !== void 0 && toolsInput === CODEQL_TOOLCACHE_INPUT) {
|
||||||
let latestToolcacheVersion;
|
let latestToolcacheVersion;
|
||||||
const allowToolcacheValue = isDynamicWorkflow() || isInTestMode();
|
const allowToolcacheValueFF = await features.getValue(
|
||||||
|
"allow_toolcache_input" /* AllowToolcacheInput */
|
||||||
|
);
|
||||||
|
const allowToolcacheValue = allowToolcacheValueFF && (isDynamicWorkflow() || isInTestMode());
|
||||||
if (allowToolcacheValue) {
|
if (allowToolcacheValue) {
|
||||||
logger.info(
|
logger.info(
|
||||||
`Attempting to use the latest CodeQL CLI version in the toolcache, as requested by 'tools: ${toolsInput}'.`
|
`Attempting to use the latest CodeQL CLI version in the toolcache, as requested by 'tools: ${toolsInput}'.`
|
||||||
@@ -89137,9 +89140,15 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian
|
|||||||
`Found no CodeQL CLI in the toolcache, ignoring 'tools: ${toolsInput}'...`
|
`Found no CodeQL CLI in the toolcache, ignoring 'tools: ${toolsInput}'...`
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
logger.warning(
|
if (allowToolcacheValueFF) {
|
||||||
`Ignoring 'tools: ${toolsInput}' because the workflow was not triggered dynamically.`
|
logger.info(
|
||||||
);
|
`Ignoring 'tools: ${toolsInput}' because the feature is not enabled.`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
logger.warning(
|
||||||
|
`Ignoring 'tools: ${toolsInput}' because the workflow was not triggered dynamically.`
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cliVersion2 = defaultCliVersion.cliVersion;
|
cliVersion2 = defaultCliVersion.cliVersion;
|
||||||
tagName = defaultCliVersion.tagName;
|
tagName = defaultCliVersion.tagName;
|
||||||
@@ -89352,7 +89361,7 @@ function getCanonicalToolcacheVersion(cliVersion2, bundleVersion2, logger) {
|
|||||||
}
|
}
|
||||||
return cliVersion2;
|
return cliVersion2;
|
||||||
}
|
}
|
||||||
async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger) {
|
async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, features, logger) {
|
||||||
if (!await isBinaryAccessible("tar", logger)) {
|
if (!await isBinaryAccessible("tar", logger)) {
|
||||||
throw new ConfigurationError(
|
throw new ConfigurationError(
|
||||||
"Could not find tar in PATH, so unable to extract CodeQL bundle."
|
"Could not find tar in PATH, so unable to extract CodeQL bundle."
|
||||||
@@ -89365,6 +89374,7 @@ async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defau
|
|||||||
apiDetails,
|
apiDetails,
|
||||||
variant,
|
variant,
|
||||||
zstdAvailability.available,
|
zstdAvailability.available,
|
||||||
|
features,
|
||||||
logger
|
logger
|
||||||
);
|
);
|
||||||
let codeqlFolder;
|
let codeqlFolder;
|
||||||
@@ -89511,7 +89521,7 @@ var GHES_VERSION_MOST_RECENTLY_DEPRECATED = "3.13";
|
|||||||
var GHES_MOST_RECENT_DEPRECATION_DATE = "2025-06-19";
|
var GHES_MOST_RECENT_DEPRECATION_DATE = "2025-06-19";
|
||||||
var EXTRACTION_DEBUG_MODE_VERBOSITY = "progress++";
|
var EXTRACTION_DEBUG_MODE_VERBOSITY = "progress++";
|
||||||
var CODEQL_VERSION_CACHE_CLEANUP = "2.17.1";
|
var CODEQL_VERSION_CACHE_CLEANUP = "2.17.1";
|
||||||
async function setupCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger, checkVersion) {
|
async function setupCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, features, logger, checkVersion) {
|
||||||
try {
|
try {
|
||||||
const {
|
const {
|
||||||
codeqlFolder,
|
codeqlFolder,
|
||||||
@@ -89525,6 +89535,7 @@ async function setupCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliV
|
|||||||
tempDir,
|
tempDir,
|
||||||
variant,
|
variant,
|
||||||
defaultCliVersion,
|
defaultCliVersion,
|
||||||
|
features,
|
||||||
logger
|
logger
|
||||||
);
|
);
|
||||||
logger.debug(
|
logger.debug(
|
||||||
@@ -90098,7 +90109,7 @@ async function getJobRunUuidSarifOptions(codeql) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// src/init.ts
|
// src/init.ts
|
||||||
async function initCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger) {
|
async function initCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, features, logger) {
|
||||||
logger.startGroup("Setup CodeQL tools");
|
logger.startGroup("Setup CodeQL tools");
|
||||||
const {
|
const {
|
||||||
codeql,
|
codeql,
|
||||||
@@ -90112,6 +90123,7 @@ async function initCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVe
|
|||||||
tempDir,
|
tempDir,
|
||||||
variant,
|
variant,
|
||||||
defaultCliVersion,
|
defaultCliVersion,
|
||||||
|
features,
|
||||||
logger,
|
logger,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
@@ -90760,6 +90772,7 @@ async function run() {
|
|||||||
getTemporaryDirectory(),
|
getTemporaryDirectory(),
|
||||||
gitHubVersion.type,
|
gitHubVersion.type,
|
||||||
codeQLDefaultVersionInfo,
|
codeQLDefaultVersionInfo,
|
||||||
|
features,
|
||||||
logger
|
logger
|
||||||
);
|
);
|
||||||
codeql = initCodeQLResult.codeql;
|
codeql = initCodeQLResult.codeql;
|
||||||
|
|||||||
29
lib/upload-lib.js
generated
29
lib/upload-lib.js
generated
@@ -90121,7 +90121,7 @@ async function findOverridingToolsInCache(humanReadableVersion, logger) {
|
|||||||
}
|
}
|
||||||
return void 0;
|
return void 0;
|
||||||
}
|
}
|
||||||
async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, variant, tarSupportsZstd, logger) {
|
async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, variant, tarSupportsZstd, features, logger) {
|
||||||
if (toolsInput && !isReservedToolsValue(toolsInput) && !toolsInput.startsWith("http")) {
|
if (toolsInput && !isReservedToolsValue(toolsInput) && !toolsInput.startsWith("http")) {
|
||||||
logger.info(`Using CodeQL CLI from local path ${toolsInput}`);
|
logger.info(`Using CodeQL CLI from local path ${toolsInput}`);
|
||||||
const compressionMethod2 = inferCompressionMethod(toolsInput);
|
const compressionMethod2 = inferCompressionMethod(toolsInput);
|
||||||
@@ -90160,7 +90160,10 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian
|
|||||||
}
|
}
|
||||||
} else if (toolsInput !== void 0 && toolsInput === CODEQL_TOOLCACHE_INPUT) {
|
} else if (toolsInput !== void 0 && toolsInput === CODEQL_TOOLCACHE_INPUT) {
|
||||||
let latestToolcacheVersion;
|
let latestToolcacheVersion;
|
||||||
const allowToolcacheValue = isDynamicWorkflow() || isInTestMode();
|
const allowToolcacheValueFF = await features.getValue(
|
||||||
|
"allow_toolcache_input" /* AllowToolcacheInput */
|
||||||
|
);
|
||||||
|
const allowToolcacheValue = allowToolcacheValueFF && (isDynamicWorkflow() || isInTestMode());
|
||||||
if (allowToolcacheValue) {
|
if (allowToolcacheValue) {
|
||||||
logger.info(
|
logger.info(
|
||||||
`Attempting to use the latest CodeQL CLI version in the toolcache, as requested by 'tools: ${toolsInput}'.`
|
`Attempting to use the latest CodeQL CLI version in the toolcache, as requested by 'tools: ${toolsInput}'.`
|
||||||
@@ -90176,9 +90179,15 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian
|
|||||||
`Found no CodeQL CLI in the toolcache, ignoring 'tools: ${toolsInput}'...`
|
`Found no CodeQL CLI in the toolcache, ignoring 'tools: ${toolsInput}'...`
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
logger.warning(
|
if (allowToolcacheValueFF) {
|
||||||
`Ignoring 'tools: ${toolsInput}' because the workflow was not triggered dynamically.`
|
logger.info(
|
||||||
);
|
`Ignoring 'tools: ${toolsInput}' because the feature is not enabled.`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
logger.warning(
|
||||||
|
`Ignoring 'tools: ${toolsInput}' because the workflow was not triggered dynamically.`
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cliVersion2 = defaultCliVersion.cliVersion;
|
cliVersion2 = defaultCliVersion.cliVersion;
|
||||||
tagName = defaultCliVersion.tagName;
|
tagName = defaultCliVersion.tagName;
|
||||||
@@ -90391,7 +90400,7 @@ function getCanonicalToolcacheVersion(cliVersion2, bundleVersion2, logger) {
|
|||||||
}
|
}
|
||||||
return cliVersion2;
|
return cliVersion2;
|
||||||
}
|
}
|
||||||
async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger) {
|
async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, features, logger) {
|
||||||
if (!await isBinaryAccessible("tar", logger)) {
|
if (!await isBinaryAccessible("tar", logger)) {
|
||||||
throw new ConfigurationError(
|
throw new ConfigurationError(
|
||||||
"Could not find tar in PATH, so unable to extract CodeQL bundle."
|
"Could not find tar in PATH, so unable to extract CodeQL bundle."
|
||||||
@@ -90404,6 +90413,7 @@ async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defau
|
|||||||
apiDetails,
|
apiDetails,
|
||||||
variant,
|
variant,
|
||||||
zstdAvailability.available,
|
zstdAvailability.available,
|
||||||
|
features,
|
||||||
logger
|
logger
|
||||||
);
|
);
|
||||||
let codeqlFolder;
|
let codeqlFolder;
|
||||||
@@ -90528,7 +90538,7 @@ var GHES_VERSION_MOST_RECENTLY_DEPRECATED = "3.13";
|
|||||||
var GHES_MOST_RECENT_DEPRECATION_DATE = "2025-06-19";
|
var GHES_MOST_RECENT_DEPRECATION_DATE = "2025-06-19";
|
||||||
var EXTRACTION_DEBUG_MODE_VERBOSITY = "progress++";
|
var EXTRACTION_DEBUG_MODE_VERBOSITY = "progress++";
|
||||||
var CODEQL_VERSION_CACHE_CLEANUP = "2.17.1";
|
var CODEQL_VERSION_CACHE_CLEANUP = "2.17.1";
|
||||||
async function setupCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger, checkVersion) {
|
async function setupCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, features, logger, checkVersion) {
|
||||||
try {
|
try {
|
||||||
const {
|
const {
|
||||||
codeqlFolder,
|
codeqlFolder,
|
||||||
@@ -90542,6 +90552,7 @@ async function setupCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliV
|
|||||||
tempDir,
|
tempDir,
|
||||||
variant,
|
variant,
|
||||||
defaultCliVersion,
|
defaultCliVersion,
|
||||||
|
features,
|
||||||
logger
|
logger
|
||||||
);
|
);
|
||||||
logger.debug(
|
logger.debug(
|
||||||
@@ -92245,7 +92256,7 @@ async function addFingerprints(sarif, sourceRoot, logger) {
|
|||||||
// src/init.ts
|
// src/init.ts
|
||||||
var toolrunner4 = __toESM(require_toolrunner());
|
var toolrunner4 = __toESM(require_toolrunner());
|
||||||
var io5 = __toESM(require_io());
|
var io5 = __toESM(require_io());
|
||||||
async function initCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger) {
|
async function initCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, features, logger) {
|
||||||
logger.startGroup("Setup CodeQL tools");
|
logger.startGroup("Setup CodeQL tools");
|
||||||
const {
|
const {
|
||||||
codeql,
|
codeql,
|
||||||
@@ -92259,6 +92270,7 @@ async function initCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVe
|
|||||||
tempDir,
|
tempDir,
|
||||||
variant,
|
variant,
|
||||||
defaultCliVersion,
|
defaultCliVersion,
|
||||||
|
features,
|
||||||
logger,
|
logger,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
@@ -92405,6 +92417,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
|
|||||||
tempDir,
|
tempDir,
|
||||||
gitHubVersion.type,
|
gitHubVersion.type,
|
||||||
codeQLDefaultVersionInfo,
|
codeQLDefaultVersionInfo,
|
||||||
|
features,
|
||||||
logger
|
logger
|
||||||
);
|
);
|
||||||
codeQL = initCodeQLResult.codeql;
|
codeQL = initCodeQLResult.codeql;
|
||||||
|
|||||||
29
lib/upload-sarif-action.js
generated
29
lib/upload-sarif-action.js
generated
@@ -90792,7 +90792,7 @@ async function findOverridingToolsInCache(humanReadableVersion, logger) {
|
|||||||
}
|
}
|
||||||
return void 0;
|
return void 0;
|
||||||
}
|
}
|
||||||
async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, variant, tarSupportsZstd, logger) {
|
async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, variant, tarSupportsZstd, features, logger) {
|
||||||
if (toolsInput && !isReservedToolsValue(toolsInput) && !toolsInput.startsWith("http")) {
|
if (toolsInput && !isReservedToolsValue(toolsInput) && !toolsInput.startsWith("http")) {
|
||||||
logger.info(`Using CodeQL CLI from local path ${toolsInput}`);
|
logger.info(`Using CodeQL CLI from local path ${toolsInput}`);
|
||||||
const compressionMethod2 = inferCompressionMethod(toolsInput);
|
const compressionMethod2 = inferCompressionMethod(toolsInput);
|
||||||
@@ -90831,7 +90831,10 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian
|
|||||||
}
|
}
|
||||||
} else if (toolsInput !== void 0 && toolsInput === CODEQL_TOOLCACHE_INPUT) {
|
} else if (toolsInput !== void 0 && toolsInput === CODEQL_TOOLCACHE_INPUT) {
|
||||||
let latestToolcacheVersion;
|
let latestToolcacheVersion;
|
||||||
const allowToolcacheValue = isDynamicWorkflow() || isInTestMode();
|
const allowToolcacheValueFF = await features.getValue(
|
||||||
|
"allow_toolcache_input" /* AllowToolcacheInput */
|
||||||
|
);
|
||||||
|
const allowToolcacheValue = allowToolcacheValueFF && (isDynamicWorkflow() || isInTestMode());
|
||||||
if (allowToolcacheValue) {
|
if (allowToolcacheValue) {
|
||||||
logger.info(
|
logger.info(
|
||||||
`Attempting to use the latest CodeQL CLI version in the toolcache, as requested by 'tools: ${toolsInput}'.`
|
`Attempting to use the latest CodeQL CLI version in the toolcache, as requested by 'tools: ${toolsInput}'.`
|
||||||
@@ -90847,9 +90850,15 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian
|
|||||||
`Found no CodeQL CLI in the toolcache, ignoring 'tools: ${toolsInput}'...`
|
`Found no CodeQL CLI in the toolcache, ignoring 'tools: ${toolsInput}'...`
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
logger.warning(
|
if (allowToolcacheValueFF) {
|
||||||
`Ignoring 'tools: ${toolsInput}' because the workflow was not triggered dynamically.`
|
logger.info(
|
||||||
);
|
`Ignoring 'tools: ${toolsInput}' because the feature is not enabled.`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
logger.warning(
|
||||||
|
`Ignoring 'tools: ${toolsInput}' because the workflow was not triggered dynamically.`
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cliVersion2 = defaultCliVersion.cliVersion;
|
cliVersion2 = defaultCliVersion.cliVersion;
|
||||||
tagName = defaultCliVersion.tagName;
|
tagName = defaultCliVersion.tagName;
|
||||||
@@ -91062,7 +91071,7 @@ function getCanonicalToolcacheVersion(cliVersion2, bundleVersion2, logger) {
|
|||||||
}
|
}
|
||||||
return cliVersion2;
|
return cliVersion2;
|
||||||
}
|
}
|
||||||
async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger) {
|
async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, features, logger) {
|
||||||
if (!await isBinaryAccessible("tar", logger)) {
|
if (!await isBinaryAccessible("tar", logger)) {
|
||||||
throw new ConfigurationError(
|
throw new ConfigurationError(
|
||||||
"Could not find tar in PATH, so unable to extract CodeQL bundle."
|
"Could not find tar in PATH, so unable to extract CodeQL bundle."
|
||||||
@@ -91075,6 +91084,7 @@ async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defau
|
|||||||
apiDetails,
|
apiDetails,
|
||||||
variant,
|
variant,
|
||||||
zstdAvailability.available,
|
zstdAvailability.available,
|
||||||
|
features,
|
||||||
logger
|
logger
|
||||||
);
|
);
|
||||||
let codeqlFolder;
|
let codeqlFolder;
|
||||||
@@ -91199,7 +91209,7 @@ var GHES_VERSION_MOST_RECENTLY_DEPRECATED = "3.13";
|
|||||||
var GHES_MOST_RECENT_DEPRECATION_DATE = "2025-06-19";
|
var GHES_MOST_RECENT_DEPRECATION_DATE = "2025-06-19";
|
||||||
var EXTRACTION_DEBUG_MODE_VERBOSITY = "progress++";
|
var EXTRACTION_DEBUG_MODE_VERBOSITY = "progress++";
|
||||||
var CODEQL_VERSION_CACHE_CLEANUP = "2.17.1";
|
var CODEQL_VERSION_CACHE_CLEANUP = "2.17.1";
|
||||||
async function setupCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger, checkVersion) {
|
async function setupCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, features, logger, checkVersion) {
|
||||||
try {
|
try {
|
||||||
const {
|
const {
|
||||||
codeqlFolder,
|
codeqlFolder,
|
||||||
@@ -91213,6 +91223,7 @@ async function setupCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliV
|
|||||||
tempDir,
|
tempDir,
|
||||||
variant,
|
variant,
|
||||||
defaultCliVersion,
|
defaultCliVersion,
|
||||||
|
features,
|
||||||
logger
|
logger
|
||||||
);
|
);
|
||||||
logger.debug(
|
logger.debug(
|
||||||
@@ -92916,7 +92927,7 @@ async function addFingerprints(sarif, sourceRoot, logger) {
|
|||||||
// src/init.ts
|
// src/init.ts
|
||||||
var toolrunner4 = __toESM(require_toolrunner());
|
var toolrunner4 = __toESM(require_toolrunner());
|
||||||
var io5 = __toESM(require_io());
|
var io5 = __toESM(require_io());
|
||||||
async function initCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger) {
|
async function initCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, features, logger) {
|
||||||
logger.startGroup("Setup CodeQL tools");
|
logger.startGroup("Setup CodeQL tools");
|
||||||
const {
|
const {
|
||||||
codeql,
|
codeql,
|
||||||
@@ -92930,6 +92941,7 @@ async function initCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVe
|
|||||||
tempDir,
|
tempDir,
|
||||||
variant,
|
variant,
|
||||||
defaultCliVersion,
|
defaultCliVersion,
|
||||||
|
features,
|
||||||
logger,
|
logger,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
@@ -93076,6 +93088,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
|
|||||||
tempDir,
|
tempDir,
|
||||||
gitHubVersion.type,
|
gitHubVersion.type,
|
||||||
codeQLDefaultVersionInfo,
|
codeQLDefaultVersionInfo,
|
||||||
|
features,
|
||||||
logger
|
logger
|
||||||
);
|
);
|
||||||
codeQL = initCodeQLResult.codeql;
|
codeQL = initCodeQLResult.codeql;
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ async function installIntoToolcache({
|
|||||||
cliVersion !== undefined
|
cliVersion !== undefined
|
||||||
? { cliVersion, tagName }
|
? { cliVersion, tagName }
|
||||||
: SAMPLE_DEFAULT_CLI_VERSION,
|
: SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
|
createFeatures([]),
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
@@ -122,6 +123,8 @@ async function stubCodeql(): Promise<codeql.CodeQL> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test("downloads and caches explicitly requested bundles that aren't in the toolcache", async (t) => {
|
test("downloads and caches explicitly requested bundles that aren't in the toolcache", async (t) => {
|
||||||
|
const features = createFeatures([]);
|
||||||
|
|
||||||
await util.withTmpDir(async (tmpDir) => {
|
await util.withTmpDir(async (tmpDir) => {
|
||||||
setupActionsVars(tmpDir, tmpDir);
|
setupActionsVars(tmpDir, tmpDir);
|
||||||
|
|
||||||
@@ -140,6 +143,7 @@ test("downloads and caches explicitly requested bundles that aren't in the toolc
|
|||||||
tmpDir,
|
tmpDir,
|
||||||
util.GitHubVariant.DOTCOM,
|
util.GitHubVariant.DOTCOM,
|
||||||
SAMPLE_DEFAULT_CLI_VERSION,
|
SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
|
features,
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
@@ -154,6 +158,8 @@ test("downloads and caches explicitly requested bundles that aren't in the toolc
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("caches semantically versioned bundles using their semantic version number", async (t) => {
|
test("caches semantically versioned bundles using their semantic version number", async (t) => {
|
||||||
|
const features = createFeatures([]);
|
||||||
|
|
||||||
await util.withTmpDir(async (tmpDir) => {
|
await util.withTmpDir(async (tmpDir) => {
|
||||||
setupActionsVars(tmpDir, tmpDir);
|
setupActionsVars(tmpDir, tmpDir);
|
||||||
const url = mockBundleDownloadApi({
|
const url = mockBundleDownloadApi({
|
||||||
@@ -166,6 +172,7 @@ test("caches semantically versioned bundles using their semantic version number"
|
|||||||
tmpDir,
|
tmpDir,
|
||||||
util.GitHubVariant.DOTCOM,
|
util.GitHubVariant.DOTCOM,
|
||||||
SAMPLE_DEFAULT_CLI_VERSION,
|
SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
|
features,
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
@@ -181,6 +188,8 @@ test("caches semantically versioned bundles using their semantic version number"
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("downloads an explicitly requested bundle even if a different version is cached", async (t) => {
|
test("downloads an explicitly requested bundle even if a different version is cached", async (t) => {
|
||||||
|
const features = createFeatures([]);
|
||||||
|
|
||||||
await util.withTmpDir(async (tmpDir) => {
|
await util.withTmpDir(async (tmpDir) => {
|
||||||
setupActionsVars(tmpDir, tmpDir);
|
setupActionsVars(tmpDir, tmpDir);
|
||||||
|
|
||||||
@@ -199,6 +208,7 @@ test("downloads an explicitly requested bundle even if a different version is ca
|
|||||||
tmpDir,
|
tmpDir,
|
||||||
util.GitHubVariant.DOTCOM,
|
util.GitHubVariant.DOTCOM,
|
||||||
SAMPLE_DEFAULT_CLI_VERSION,
|
SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
|
features,
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
@@ -227,6 +237,8 @@ for (const {
|
|||||||
expectedToolcacheVersion,
|
expectedToolcacheVersion,
|
||||||
} of EXPLICITLY_REQUESTED_BUNDLE_TEST_CASES) {
|
} of EXPLICITLY_REQUESTED_BUNDLE_TEST_CASES) {
|
||||||
test(`caches explicitly requested bundle ${tagName} as ${expectedToolcacheVersion}`, async (t) => {
|
test(`caches explicitly requested bundle ${tagName} as ${expectedToolcacheVersion}`, async (t) => {
|
||||||
|
const features = createFeatures([]);
|
||||||
|
|
||||||
await util.withTmpDir(async (tmpDir) => {
|
await util.withTmpDir(async (tmpDir) => {
|
||||||
setupActionsVars(tmpDir, tmpDir);
|
setupActionsVars(tmpDir, tmpDir);
|
||||||
|
|
||||||
@@ -243,6 +255,7 @@ for (const {
|
|||||||
tmpDir,
|
tmpDir,
|
||||||
util.GitHubVariant.DOTCOM,
|
util.GitHubVariant.DOTCOM,
|
||||||
SAMPLE_DEFAULT_CLI_VERSION,
|
SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
|
features,
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
@@ -266,6 +279,8 @@ for (const toolcacheVersion of [
|
|||||||
`uses tools from toolcache when ${SAMPLE_DEFAULT_CLI_VERSION.cliVersion} is requested and ` +
|
`uses tools from toolcache when ${SAMPLE_DEFAULT_CLI_VERSION.cliVersion} is requested and ` +
|
||||||
`${toolcacheVersion} is installed`,
|
`${toolcacheVersion} is installed`,
|
||||||
async (t) => {
|
async (t) => {
|
||||||
|
const features = createFeatures([]);
|
||||||
|
|
||||||
await util.withTmpDir(async (tmpDir) => {
|
await util.withTmpDir(async (tmpDir) => {
|
||||||
setupActionsVars(tmpDir, tmpDir);
|
setupActionsVars(tmpDir, tmpDir);
|
||||||
|
|
||||||
@@ -281,6 +296,7 @@ for (const toolcacheVersion of [
|
|||||||
tmpDir,
|
tmpDir,
|
||||||
util.GitHubVariant.DOTCOM,
|
util.GitHubVariant.DOTCOM,
|
||||||
SAMPLE_DEFAULT_CLI_VERSION,
|
SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
|
features,
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
@@ -295,6 +311,8 @@ for (const toolcacheVersion of [
|
|||||||
}
|
}
|
||||||
|
|
||||||
test(`uses a cached bundle when no tools input is given on GHES`, async (t) => {
|
test(`uses a cached bundle when no tools input is given on GHES`, async (t) => {
|
||||||
|
const features = createFeatures([]);
|
||||||
|
|
||||||
await util.withTmpDir(async (tmpDir) => {
|
await util.withTmpDir(async (tmpDir) => {
|
||||||
setupActionsVars(tmpDir, tmpDir);
|
setupActionsVars(tmpDir, tmpDir);
|
||||||
|
|
||||||
@@ -313,6 +331,7 @@ test(`uses a cached bundle when no tools input is given on GHES`, async (t) => {
|
|||||||
cliVersion: defaults.cliVersion,
|
cliVersion: defaults.cliVersion,
|
||||||
tagName: defaults.bundleVersion,
|
tagName: defaults.bundleVersion,
|
||||||
},
|
},
|
||||||
|
features,
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
@@ -328,6 +347,8 @@ test(`uses a cached bundle when no tools input is given on GHES`, async (t) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test(`downloads bundle if only an unpinned version is cached on GHES`, async (t) => {
|
test(`downloads bundle if only an unpinned version is cached on GHES`, async (t) => {
|
||||||
|
const features = createFeatures([]);
|
||||||
|
|
||||||
await util.withTmpDir(async (tmpDir) => {
|
await util.withTmpDir(async (tmpDir) => {
|
||||||
setupActionsVars(tmpDir, tmpDir);
|
setupActionsVars(tmpDir, tmpDir);
|
||||||
|
|
||||||
@@ -349,6 +370,7 @@ test(`downloads bundle if only an unpinned version is cached on GHES`, async (t)
|
|||||||
cliVersion: defaults.cliVersion,
|
cliVersion: defaults.cliVersion,
|
||||||
tagName: defaults.bundleVersion,
|
tagName: defaults.bundleVersion,
|
||||||
},
|
},
|
||||||
|
features,
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
@@ -364,6 +386,8 @@ test(`downloads bundle if only an unpinned version is cached on GHES`, async (t)
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('downloads bundle if "latest" tools specified but not cached', async (t) => {
|
test('downloads bundle if "latest" tools specified but not cached', async (t) => {
|
||||||
|
const features = createFeatures([]);
|
||||||
|
|
||||||
await util.withTmpDir(async (tmpDir) => {
|
await util.withTmpDir(async (tmpDir) => {
|
||||||
setupActionsVars(tmpDir, tmpDir);
|
setupActionsVars(tmpDir, tmpDir);
|
||||||
|
|
||||||
@@ -382,6 +406,7 @@ test('downloads bundle if "latest" tools specified but not cached', async (t) =>
|
|||||||
tmpDir,
|
tmpDir,
|
||||||
util.GitHubVariant.DOTCOM,
|
util.GitHubVariant.DOTCOM,
|
||||||
SAMPLE_DEFAULT_CLI_VERSION,
|
SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
|
features,
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
@@ -397,6 +422,8 @@ test('downloads bundle if "latest" tools specified but not cached', async (t) =>
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("bundle URL from another repo is cached as 0.0.0-bundleVersion", async (t) => {
|
test("bundle URL from another repo is cached as 0.0.0-bundleVersion", async (t) => {
|
||||||
|
const features = createFeatures([]);
|
||||||
|
|
||||||
await util.withTmpDir(async (tmpDir) => {
|
await util.withTmpDir(async (tmpDir) => {
|
||||||
setupActionsVars(tmpDir, tmpDir);
|
setupActionsVars(tmpDir, tmpDir);
|
||||||
|
|
||||||
@@ -417,6 +444,7 @@ test("bundle URL from another repo is cached as 0.0.0-bundleVersion", async (t)
|
|||||||
tmpDir,
|
tmpDir,
|
||||||
util.GitHubVariant.DOTCOM,
|
util.GitHubVariant.DOTCOM,
|
||||||
SAMPLE_DEFAULT_CLI_VERSION,
|
SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
|
features,
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -309,6 +309,7 @@ const CODEQL_VERSION_CACHE_CLEANUP = "2.17.1";
|
|||||||
* @param tempDir
|
* @param tempDir
|
||||||
* @param variant
|
* @param variant
|
||||||
* @param defaultCliVersion
|
* @param defaultCliVersion
|
||||||
|
* @param features Information about the features that are enabled.
|
||||||
* @param logger
|
* @param logger
|
||||||
* @param checkVersion Whether to check that CodeQL CLI meets the minimum
|
* @param checkVersion Whether to check that CodeQL CLI meets the minimum
|
||||||
* version requirement. Must be set to true outside tests.
|
* version requirement. Must be set to true outside tests.
|
||||||
@@ -320,6 +321,7 @@ export async function setupCodeQL(
|
|||||||
tempDir: string,
|
tempDir: string,
|
||||||
variant: util.GitHubVariant,
|
variant: util.GitHubVariant,
|
||||||
defaultCliVersion: CodeQLDefaultVersionInfo,
|
defaultCliVersion: CodeQLDefaultVersionInfo,
|
||||||
|
features: FeatureEnablement,
|
||||||
logger: Logger,
|
logger: Logger,
|
||||||
checkVersion: boolean,
|
checkVersion: boolean,
|
||||||
): Promise<{
|
): Promise<{
|
||||||
@@ -342,6 +344,7 @@ export async function setupCodeQL(
|
|||||||
tempDir,
|
tempDir,
|
||||||
variant,
|
variant,
|
||||||
defaultCliVersion,
|
defaultCliVersion,
|
||||||
|
features,
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -248,6 +248,7 @@ async function run() {
|
|||||||
getTemporaryDirectory(),
|
getTemporaryDirectory(),
|
||||||
gitHubVersion.type,
|
gitHubVersion.type,
|
||||||
codeQLDefaultVersionInfo,
|
codeQLDefaultVersionInfo,
|
||||||
|
features,
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
codeql = initCodeQLResult.codeql;
|
codeql = initCodeQLResult.codeql;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { getOptionalInput, isSelfHostedRunner } from "./actions-util";
|
|||||||
import { GitHubApiDetails } from "./api-client";
|
import { GitHubApiDetails } from "./api-client";
|
||||||
import { CodeQL, setupCodeQL } from "./codeql";
|
import { CodeQL, setupCodeQL } from "./codeql";
|
||||||
import * as configUtils from "./config-utils";
|
import * as configUtils from "./config-utils";
|
||||||
import { CodeQLDefaultVersionInfo } from "./feature-flags";
|
import { CodeQLDefaultVersionInfo, FeatureEnablement } from "./feature-flags";
|
||||||
import { KnownLanguage, Language } from "./languages";
|
import { KnownLanguage, Language } from "./languages";
|
||||||
import { Logger, withGroupAsync } from "./logging";
|
import { Logger, withGroupAsync } from "./logging";
|
||||||
import { ToolsSource } from "./setup-codeql";
|
import { ToolsSource } from "./setup-codeql";
|
||||||
@@ -23,6 +23,7 @@ export async function initCodeQL(
|
|||||||
tempDir: string,
|
tempDir: string,
|
||||||
variant: util.GitHubVariant,
|
variant: util.GitHubVariant,
|
||||||
defaultCliVersion: CodeQLDefaultVersionInfo,
|
defaultCliVersion: CodeQLDefaultVersionInfo,
|
||||||
|
features: FeatureEnablement,
|
||||||
logger: Logger,
|
logger: Logger,
|
||||||
): Promise<{
|
): Promise<{
|
||||||
codeql: CodeQL;
|
codeql: CodeQL;
|
||||||
@@ -44,6 +45,7 @@ export async function initCodeQL(
|
|||||||
tempDir,
|
tempDir,
|
||||||
variant,
|
variant,
|
||||||
defaultCliVersion,
|
defaultCliVersion,
|
||||||
|
features,
|
||||||
logger,
|
logger,
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import {
|
|||||||
LoggedMessage,
|
LoggedMessage,
|
||||||
SAMPLE_DEFAULT_CLI_VERSION,
|
SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
SAMPLE_DOTCOM_API_DETAILS,
|
SAMPLE_DOTCOM_API_DETAILS,
|
||||||
|
createFeatures,
|
||||||
getRecordingLogger,
|
getRecordingLogger,
|
||||||
initializeFeatures,
|
initializeFeatures,
|
||||||
mockBundleDownloadApi,
|
mockBundleDownloadApi,
|
||||||
@@ -91,6 +92,8 @@ test("getCodeQLActionRepository", (t) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("getCodeQLSource sets CLI version for a semver tagged bundle", async (t) => {
|
test("getCodeQLSource sets CLI version for a semver tagged bundle", async (t) => {
|
||||||
|
const features = createFeatures([]);
|
||||||
|
|
||||||
await withTmpDir(async (tmpDir) => {
|
await withTmpDir(async (tmpDir) => {
|
||||||
setupActionsVars(tmpDir, tmpDir);
|
setupActionsVars(tmpDir, tmpDir);
|
||||||
const tagName = "codeql-bundle-v1.2.3";
|
const tagName = "codeql-bundle-v1.2.3";
|
||||||
@@ -101,6 +104,7 @@ test("getCodeQLSource sets CLI version for a semver tagged bundle", async (t) =>
|
|||||||
SAMPLE_DOTCOM_API_DETAILS,
|
SAMPLE_DOTCOM_API_DETAILS,
|
||||||
GitHubVariant.DOTCOM,
|
GitHubVariant.DOTCOM,
|
||||||
false,
|
false,
|
||||||
|
features,
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -110,6 +114,8 @@ test("getCodeQLSource sets CLI version for a semver tagged bundle", async (t) =>
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("getCodeQLSource correctly returns bundled CLI version when tools == linked", async (t) => {
|
test("getCodeQLSource correctly returns bundled CLI version when tools == linked", async (t) => {
|
||||||
|
const features = createFeatures([]);
|
||||||
|
|
||||||
await withTmpDir(async (tmpDir) => {
|
await withTmpDir(async (tmpDir) => {
|
||||||
setupActionsVars(tmpDir, tmpDir);
|
setupActionsVars(tmpDir, tmpDir);
|
||||||
const source = await setupCodeql.getCodeQLSource(
|
const source = await setupCodeql.getCodeQLSource(
|
||||||
@@ -118,6 +124,7 @@ test("getCodeQLSource correctly returns bundled CLI version when tools == linked
|
|||||||
SAMPLE_DOTCOM_API_DETAILS,
|
SAMPLE_DOTCOM_API_DETAILS,
|
||||||
GitHubVariant.DOTCOM,
|
GitHubVariant.DOTCOM,
|
||||||
false,
|
false,
|
||||||
|
features,
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -129,6 +136,7 @@ test("getCodeQLSource correctly returns bundled CLI version when tools == linked
|
|||||||
test("getCodeQLSource correctly returns bundled CLI version when tools == latest", async (t) => {
|
test("getCodeQLSource correctly returns bundled CLI version when tools == latest", async (t) => {
|
||||||
const loggedMessages: LoggedMessage[] = [];
|
const loggedMessages: LoggedMessage[] = [];
|
||||||
const logger = getRecordingLogger(loggedMessages);
|
const logger = getRecordingLogger(loggedMessages);
|
||||||
|
const features = createFeatures([]);
|
||||||
|
|
||||||
await withTmpDir(async (tmpDir) => {
|
await withTmpDir(async (tmpDir) => {
|
||||||
setupActionsVars(tmpDir, tmpDir);
|
setupActionsVars(tmpDir, tmpDir);
|
||||||
@@ -138,6 +146,7 @@ test("getCodeQLSource correctly returns bundled CLI version when tools == latest
|
|||||||
SAMPLE_DOTCOM_API_DETAILS,
|
SAMPLE_DOTCOM_API_DETAILS,
|
||||||
GitHubVariant.DOTCOM,
|
GitHubVariant.DOTCOM,
|
||||||
false,
|
false,
|
||||||
|
features,
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -162,6 +171,7 @@ test("getCodeQLSource correctly returns bundled CLI version when tools == latest
|
|||||||
test("setupCodeQLBundle logs the CodeQL CLI version being used when asked to use linked tools", async (t) => {
|
test("setupCodeQLBundle logs the CodeQL CLI version being used when asked to use linked tools", async (t) => {
|
||||||
const loggedMessages: LoggedMessage[] = [];
|
const loggedMessages: LoggedMessage[] = [];
|
||||||
const logger = getRecordingLogger(loggedMessages);
|
const logger = getRecordingLogger(loggedMessages);
|
||||||
|
const features = createFeatures([]);
|
||||||
|
|
||||||
// Stub the downloadCodeQL function to prevent downloading artefacts
|
// Stub the downloadCodeQL function to prevent downloading artefacts
|
||||||
// during testing from being called.
|
// during testing from being called.
|
||||||
@@ -186,6 +196,7 @@ test("setupCodeQLBundle logs the CodeQL CLI version being used when asked to use
|
|||||||
"tmp/codeql_action_test/",
|
"tmp/codeql_action_test/",
|
||||||
GitHubVariant.DOTCOM,
|
GitHubVariant.DOTCOM,
|
||||||
SAMPLE_DEFAULT_CLI_VERSION,
|
SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
|
features,
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -208,6 +219,7 @@ test("setupCodeQLBundle logs the CodeQL CLI version being used when asked to use
|
|||||||
test("setupCodeQLBundle logs the CodeQL CLI version being used when asked to download a non-default bundle", async (t) => {
|
test("setupCodeQLBundle logs the CodeQL CLI version being used when asked to download a non-default bundle", async (t) => {
|
||||||
const loggedMessages: LoggedMessage[] = [];
|
const loggedMessages: LoggedMessage[] = [];
|
||||||
const logger = getRecordingLogger(loggedMessages);
|
const logger = getRecordingLogger(loggedMessages);
|
||||||
|
const features = createFeatures([]);
|
||||||
|
|
||||||
const bundleUrl =
|
const bundleUrl =
|
||||||
"https://github.com/github/codeql-action/releases/download/codeql-bundle-v2.16.0/codeql-bundle-linux64.tar.gz";
|
"https://github.com/github/codeql-action/releases/download/codeql-bundle-v2.16.0/codeql-bundle-linux64.tar.gz";
|
||||||
@@ -236,6 +248,7 @@ test("setupCodeQLBundle logs the CodeQL CLI version being used when asked to dow
|
|||||||
"tmp/codeql_action_test/",
|
"tmp/codeql_action_test/",
|
||||||
GitHubVariant.DOTCOM,
|
GitHubVariant.DOTCOM,
|
||||||
SAMPLE_DEFAULT_CLI_VERSION,
|
SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
|
features,
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -258,6 +271,7 @@ test("setupCodeQLBundle logs the CodeQL CLI version being used when asked to dow
|
|||||||
test("getCodeQLSource correctly returns latest version from toolcache when tools == toolcache", async (t) => {
|
test("getCodeQLSource correctly returns latest version from toolcache when tools == toolcache", async (t) => {
|
||||||
const loggedMessages: LoggedMessage[] = [];
|
const loggedMessages: LoggedMessage[] = [];
|
||||||
const logger = getRecordingLogger(loggedMessages);
|
const logger = getRecordingLogger(loggedMessages);
|
||||||
|
const features = createFeatures([Feature.AllowToolcacheInput]);
|
||||||
|
|
||||||
process.env["GITHUB_EVENT_NAME"] = "dynamic";
|
process.env["GITHUB_EVENT_NAME"] = "dynamic";
|
||||||
|
|
||||||
@@ -280,6 +294,7 @@ test("getCodeQLSource correctly returns latest version from toolcache when tools
|
|||||||
SAMPLE_DOTCOM_API_DETAILS,
|
SAMPLE_DOTCOM_API_DETAILS,
|
||||||
GitHubVariant.DOTCOM,
|
GitHubVariant.DOTCOM,
|
||||||
false,
|
false,
|
||||||
|
features,
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -319,6 +334,7 @@ test("getCodeQLSource correctly returns latest version from toolcache when tools
|
|||||||
test("getCodeQLSource falls back to downloading the CLI if the toolcache doesn't have a CodeQL CLI when tools == toolcache", async (t) => {
|
test("getCodeQLSource falls back to downloading the CLI if the toolcache doesn't have a CodeQL CLI when tools == toolcache", async (t) => {
|
||||||
const loggedMessages: LoggedMessage[] = [];
|
const loggedMessages: LoggedMessage[] = [];
|
||||||
const logger = getRecordingLogger(loggedMessages);
|
const logger = getRecordingLogger(loggedMessages);
|
||||||
|
const features = createFeatures([Feature.AllowToolcacheInput]);
|
||||||
|
|
||||||
process.env["GITHUB_EVENT_NAME"] = "dynamic";
|
process.env["GITHUB_EVENT_NAME"] = "dynamic";
|
||||||
|
|
||||||
@@ -335,6 +351,7 @@ test("getCodeQLSource falls back to downloading the CLI if the toolcache doesn't
|
|||||||
SAMPLE_DOTCOM_API_DETAILS,
|
SAMPLE_DOTCOM_API_DETAILS,
|
||||||
GitHubVariant.DOTCOM,
|
GitHubVariant.DOTCOM,
|
||||||
false,
|
false,
|
||||||
|
features,
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import * as defaults from "./defaults.json";
|
|||||||
import {
|
import {
|
||||||
CODEQL_VERSION_ZSTD_BUNDLE,
|
CODEQL_VERSION_ZSTD_BUNDLE,
|
||||||
CodeQLDefaultVersionInfo,
|
CodeQLDefaultVersionInfo,
|
||||||
|
Feature,
|
||||||
|
FeatureEnablement,
|
||||||
} from "./feature-flags";
|
} from "./feature-flags";
|
||||||
import { Logger } from "./logging";
|
import { Logger } from "./logging";
|
||||||
import * as tar from "./tar";
|
import * as tar from "./tar";
|
||||||
@@ -276,6 +278,7 @@ export async function getCodeQLSource(
|
|||||||
apiDetails: api.GitHubApiDetails,
|
apiDetails: api.GitHubApiDetails,
|
||||||
variant: util.GitHubVariant,
|
variant: util.GitHubVariant,
|
||||||
tarSupportsZstd: boolean,
|
tarSupportsZstd: boolean,
|
||||||
|
features: FeatureEnablement,
|
||||||
logger: Logger,
|
logger: Logger,
|
||||||
): Promise<CodeQLToolsSource> {
|
): Promise<CodeQLToolsSource> {
|
||||||
if (
|
if (
|
||||||
@@ -356,7 +359,11 @@ export async function getCodeQLSource(
|
|||||||
// We only allow `toolsInput === "toolcache"` for `dynamic` events. In general, using `toolsInput === "toolcache"`
|
// We only allow `toolsInput === "toolcache"` for `dynamic` events. In general, using `toolsInput === "toolcache"`
|
||||||
// can lead to alert wobble and so it shouldn't be used for an analysis where results are intended to be uploaded.
|
// can lead to alert wobble and so it shouldn't be used for an analysis where results are intended to be uploaded.
|
||||||
// We also allow this in test mode.
|
// We also allow this in test mode.
|
||||||
const allowToolcacheValue = isDynamicWorkflow() || util.isInTestMode();
|
const allowToolcacheValueFF = await features.getValue(
|
||||||
|
Feature.AllowToolcacheInput,
|
||||||
|
);
|
||||||
|
const allowToolcacheValue =
|
||||||
|
allowToolcacheValueFF && (isDynamicWorkflow() || util.isInTestMode());
|
||||||
if (allowToolcacheValue) {
|
if (allowToolcacheValue) {
|
||||||
// If `toolsInput === "toolcache"`, try to find the latest version of the CLI that's available in the toolcache
|
// If `toolsInput === "toolcache"`, try to find the latest version of the CLI that's available in the toolcache
|
||||||
// and use that. We perform this check here since we can set `cliVersion` directly and don't want to default to
|
// and use that. We perform this check here since we can set `cliVersion` directly and don't want to default to
|
||||||
@@ -377,9 +384,15 @@ export async function getCodeQLSource(
|
|||||||
`Found no CodeQL CLI in the toolcache, ignoring 'tools: ${toolsInput}'...`,
|
`Found no CodeQL CLI in the toolcache, ignoring 'tools: ${toolsInput}'...`,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
logger.warning(
|
if (allowToolcacheValueFF) {
|
||||||
`Ignoring 'tools: ${toolsInput}' because the workflow was not triggered dynamically.`,
|
logger.info(
|
||||||
);
|
`Ignoring 'tools: ${toolsInput}' because the feature is not enabled.`,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
logger.warning(
|
||||||
|
`Ignoring 'tools: ${toolsInput}' because the workflow was not triggered dynamically.`,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cliVersion = defaultCliVersion.cliVersion;
|
cliVersion = defaultCliVersion.cliVersion;
|
||||||
@@ -735,6 +748,7 @@ export async function setupCodeQLBundle(
|
|||||||
tempDir: string,
|
tempDir: string,
|
||||||
variant: util.GitHubVariant,
|
variant: util.GitHubVariant,
|
||||||
defaultCliVersion: CodeQLDefaultVersionInfo,
|
defaultCliVersion: CodeQLDefaultVersionInfo,
|
||||||
|
features: FeatureEnablement,
|
||||||
logger: Logger,
|
logger: Logger,
|
||||||
) {
|
) {
|
||||||
if (!(await util.isBinaryAccessible("tar", logger))) {
|
if (!(await util.isBinaryAccessible("tar", logger))) {
|
||||||
@@ -750,6 +764,7 @@ export async function setupCodeQLBundle(
|
|||||||
apiDetails,
|
apiDetails,
|
||||||
variant,
|
variant,
|
||||||
zstdAvailability.available,
|
zstdAvailability.available,
|
||||||
|
features,
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -262,6 +262,7 @@ async function combineSarifFilesUsingCLI(
|
|||||||
tempDir,
|
tempDir,
|
||||||
gitHubVersion.type,
|
gitHubVersion.type,
|
||||||
codeQLDefaultVersionInfo,
|
codeQLDefaultVersionInfo,
|
||||||
|
features,
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user