Throw configuration error when tar is not available
This commit is contained in:
parent
a1695c562b
commit
b500b62cea
9 changed files with 41 additions and 30 deletions
3
lib/setup-codeql.js
generated
3
lib/setup-codeql.js
generated
|
|
@ -463,6 +463,9 @@ function getCanonicalToolcacheVersion(cliVersion, bundleVersion, logger) {
|
|||
* @returns the path to the extracted bundle, and the version of the tools
|
||||
*/
|
||||
async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, features, defaultCliVersion, logger) {
|
||||
if (!(await util.isBinaryAccessible("tar", logger))) {
|
||||
throw new util.ConfigurationError("Could not find tar in PATH, so unable to extract CodeQL bundle.");
|
||||
}
|
||||
const zstdAvailability = await tar.isZstdAvailable(logger);
|
||||
const source = await getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, variant, zstdAvailability.available, logger);
|
||||
let codeqlFolder;
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
13
lib/tar.js
generated
13
lib/tar.js
generated
|
|
@ -42,17 +42,6 @@ const actions_util_1 = require("./actions-util");
|
|||
const util_1 = require("./util");
|
||||
const MIN_REQUIRED_BSD_TAR_VERSION = "3.4.3";
|
||||
const MIN_REQUIRED_GNU_TAR_VERSION = "1.31";
|
||||
async function isBinaryAccessible(binary, logger) {
|
||||
try {
|
||||
await (0, safe_which_1.safeWhich)(binary);
|
||||
logger.debug(`Found ${binary}.`);
|
||||
return true;
|
||||
}
|
||||
catch (e) {
|
||||
logger.debug(`Could not find ${binary}: ${e}`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
async function getTarVersion() {
|
||||
const tar = await (0, safe_which_1.safeWhich)("tar");
|
||||
let stdout = "";
|
||||
|
|
@ -86,7 +75,7 @@ async function getTarVersion() {
|
|||
}
|
||||
}
|
||||
async function isZstdAvailable(logger) {
|
||||
const foundZstdBinary = await isBinaryAccessible("zstd", logger);
|
||||
const foundZstdBinary = await (0, util_1.isBinaryAccessible)("zstd", logger);
|
||||
try {
|
||||
const tarVersion = await getTarVersion();
|
||||
const { type, version } = tarVersion;
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
13
lib/util.js
generated
13
lib/util.js
generated
|
|
@ -69,12 +69,14 @@ exports.checkActionVersion = checkActionVersion;
|
|||
exports.cloneObject = cloneObject;
|
||||
exports.checkSipEnablement = checkSipEnablement;
|
||||
exports.cleanUpGlob = cleanUpGlob;
|
||||
exports.isBinaryAccessible = isBinaryAccessible;
|
||||
const fs = __importStar(require("fs"));
|
||||
const os = __importStar(require("os"));
|
||||
const path = __importStar(require("path"));
|
||||
const util_1 = require("util");
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const exec = __importStar(require("@actions/exec/lib/exec"));
|
||||
const safe_which_1 = require("@chrisgavin/safe-which");
|
||||
const check_disk_space_1 = __importDefault(require("check-disk-space"));
|
||||
const del_1 = __importDefault(require("del"));
|
||||
const get_folder_size_1 = __importDefault(require("get-folder-size"));
|
||||
|
|
@ -926,4 +928,15 @@ async function cleanUpGlob(glob, name, logger) {
|
|||
logger.warning(`Failed to clean up ${name}: ${e}.`);
|
||||
}
|
||||
}
|
||||
async function isBinaryAccessible(binary, logger) {
|
||||
try {
|
||||
await (0, safe_which_1.safeWhich)(binary);
|
||||
logger.debug(`Found ${binary}.`);
|
||||
return true;
|
||||
}
|
||||
catch (e) {
|
||||
logger.debug(`Could not find ${binary}: ${e}`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=util.js.map
|
||||
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue