Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
aff7998
Initial plan
Copilot Dec 16, 2025
89753aa
Add git version check for overlay analysis enablement
Copilot Dec 16, 2025
fc2bbb0
Address code review feedback
Copilot Dec 16, 2025
c3dc529
Address feedback: cache git version, improve error handling, add tele…
Copilot Dec 16, 2025
393c074
Refactor existing telemetry diagnostics to use makeTelemetryDiagnostic
Copilot Dec 16, 2025
32795b3
Merge branch 'main' into copilot/update-overlay-git-version-check
henrymercer Dec 17, 2025
e052dbd
Remove caching mechanism
henrymercer Dec 17, 2025
3765106
Move git version logging to config utils
henrymercer Dec 17, 2025
9c5588d
Remove unnecessary stub restores
henrymercer Dec 17, 2025
056581e
Update `makeTelemetryDiagnostic` doc
henrymercer Dec 17, 2025
a13b404
Record both truncated and full git versions
henrymercer Dec 17, 2025
a2c3c8e
Bump log level for failing to parse git version
henrymercer Dec 17, 2025
003ddae
Avoid non-determinism in PR checks due to overlay FFs
henrymercer Dec 18, 2025
358a55e
Throw in test mode if can't compute git version
henrymercer Dec 18, 2025
cec3cc5
Trim git version output
henrymercer Dec 18, 2025
948c7fb
Test mode: Tolerate missing git binary
henrymercer Dec 18, 2025
ff84c6f
Improve comment
henrymercer Dec 18, 2025
a7e88a4
Only enable overlay for the code scanning suite
henrymercer Dec 18, 2025
95246ce
Prefer explicit env var to binary accessibility check
henrymercer Dec 18, 2025
034401b
Merge branch 'main' into copilot/update-overlay-git-version-check
henrymercer Dec 18, 2025
8b428c0
Use `EnvVar`
henrymercer Dec 18, 2025
3b6fef6
Fix import order
henrymercer Dec 18, 2025
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
1 change: 1 addition & 0 deletions .github/workflows/__global-proxy.yml

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

2 changes: 1 addition & 1 deletion lib/init-action.js

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

1 change: 1 addition & 0 deletions pr-checks/checks/global-proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ services:
- 3128:3128
env:
https_proxy: http://squid-proxy:3128
CODEQL_ACTION_TOLERATE_MISSING_GIT_VERSION: true
steps:
- uses: ./../action/init
with:
Expand Down
12 changes: 7 additions & 5 deletions src/config-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ import {
getCodeQLMemoryLimit,
getErrorMessage,
isInTestMode,
isBinaryAccessible,
} from "./util";

export * from "./config/db-config";
Expand Down Expand Up @@ -937,10 +936,13 @@ export async function initConfig(
await logGitVersionTelemetry(config, gitVersion);
} catch (e) {
logger.warning(`Could not determine Git version: ${getErrorMessage(e)}`);
// Throw the error in test mode so it's more visible, but tolerate cases
// where the git binary is not present, for example because we're running
// in a Docker container.
if (isInTestMode() && (await isBinaryAccessible("git", logger))) {
// Throw the error in test mode so it's more visible, unless the environment
// variable is set to tolerate this, for example because we're running in a
// Docker container where git may not be available.
if (
isInTestMode() &&
process.env.CODEQL_ACTION_TOLERATE_MISSING_GIT_VERSION !== "true"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You added TOLERATE_MISSING_GIT_VERSION to the EnvVar enum, but aren't using it here.

) {
throw e;
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,10 @@ export enum EnvVar {
* the workflow is valid and validation is not necessary.
*/
SKIP_WORKFLOW_VALIDATION = "CODEQL_ACTION_SKIP_WORKFLOW_VALIDATION",

/**
* Whether to tolerate failure to determine the git version (only applicable in test mode).
* Intended for use in environments where git may not be installed, such as Docker containers.
*/
TOLERATE_MISSING_GIT_VERSION = "CODEQL_ACTION_TOLERATE_MISSING_GIT_VERSION",
}
3 changes: 0 additions & 3 deletions src/git-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ export class GitVersionInfo {
/**
* Gets the version of Git installed on the system and throws an error if
* the version cannot be determined.
*
* @returns The Git version string (e.g., "2.40.0").
* @throws {Error} if the version could not be determined.
*/
export async function getGitVersionOrThrow(): Promise<GitVersionInfo> {
const stdout = await runGitCommand(
Expand Down
Loading