Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
58f2dfc
Log result of `validateWorkflow` if not `undefined`
mbg Nov 12, 2024
69656af
Update changelog and version after v3.27.4
github-actions[bot] Nov 14, 2024
49ec97c
Update checked-in dependencies
github-actions[bot] Nov 14, 2024
1443ef5
Merge pull request #2606 from github/mergeback/v3.27.4-to-main-ea9e4e37
mbg Nov 14, 2024
a1695c5
Merge pull request #2598 from github/mbg/fix/validateWorkflowResult
mbg Nov 14, 2024
43b75f7
Bump the npm group with 4 updates
dependabot[bot] Nov 18, 2024
9465261
Update checked-in dependencies
github-actions[bot] Nov 18, 2024
b500b62
Throw configuration error when `tar` is not available
angelapwen Nov 18, 2024
9222a97
Merge pull request #2611 from github/angelapwen/catch-tar-error
angelapwen Nov 18, 2024
f9ada54
Telemetry: report OS release for GitHub-hosted Linux runners
angelapwen Nov 18, 2024
e3c67a0
Merge pull request #2610 from github/dependabot/npm_and_yarn/npm-d2ca…
angelapwen Nov 18, 2024
ecde4d2
Bump cross-spawn from 7.0.3 to 7.0.6 in the npm_and_yarn group
dependabot[bot] Nov 18, 2024
db67881
Update checked-in dependencies
github-actions[bot] Nov 18, 2024
e782c3a
Merge pull request #2612 from github/angelapwen/report-linux-runner-r…
angelapwen Nov 18, 2024
cba5fb5
Merge pull request #2613 from github/dependabot/npm_and_yarn/npm_and_…
aeisenberg Nov 19, 2024
8f3b487
Start-proxy: Fetch OS specific binary
marcogario Nov 19, 2024
a6c8729
Merge pull request #2614 from github/marcogario/per-platform-proxy
marcogario Nov 19, 2024
67b73ea
Update changelog for v3.27.5
github-actions[bot] Nov 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Throw configuration error when tar is not available
  • Loading branch information
angelapwen committed Nov 18, 2024
commit b500b62cea20d59349551c85875368747e043ae3
3 changes: 3 additions & 0 deletions lib/setup-codeql.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/setup-codeql.js.map

Large diffs are not rendered by default.

13 changes: 1 addition & 12 deletions lib/tar.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/tar.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions lib/util.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/util.js.map

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/setup-codeql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,11 @@ export async function setupCodeQLBundle(
defaultCliVersion: CodeQLDefaultVersionInfo,
logger: 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(
Expand Down
16 changes: 1 addition & 15 deletions src/tar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { v4 as uuidV4 } from "uuid";

import { CommandInvocationError, getTemporaryDirectory } from "./actions-util";
import { Logger } from "./logging";
import { assertNever, cleanUpGlob } from "./util";
import { assertNever, cleanUpGlob, isBinaryAccessible } from "./util";

const MIN_REQUIRED_BSD_TAR_VERSION = "3.4.3";
const MIN_REQUIRED_GNU_TAR_VERSION = "1.31";
Expand All @@ -20,20 +20,6 @@ export type TarVersion = {
version: string;
};

async function isBinaryAccessible(
binary: string,
logger: Logger,
): Promise<boolean> {
try {
await safeWhich(binary);
logger.debug(`Found ${binary}.`);
return true;
} catch (e) {
logger.debug(`Could not find ${binary}: ${e}`);
return false;
}
}

async function getTarVersion(): Promise<TarVersion> {
const tar = await safeWhich("tar");
let stdout = "";
Expand Down
15 changes: 15 additions & 0 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { promisify } from "util";

import * as core from "@actions/core";
import * as exec from "@actions/exec/lib/exec";
import { safeWhich } from "@chrisgavin/safe-which";
import checkDiskSpace from "check-disk-space";
import del from "del";
import getFolderSize from "get-folder-size";
Expand Down Expand Up @@ -1187,3 +1188,17 @@ export async function cleanUpGlob(glob: string, name: string, logger: Logger) {
logger.warning(`Failed to clean up ${name}: ${e}.`);
}
}

export async function isBinaryAccessible(
binary: string,
logger: Logger,
): Promise<boolean> {
try {
await safeWhich(binary);
logger.debug(`Found ${binary}.`);
return true;
} catch (e) {
logger.debug(`Could not find ${binary}: ${e}`);
return false;
}
}
Loading