Merge branch 'main' into NlightNFotis/detect_use_proxy_when_streaming
This commit is contained in:
commit
c6454d58c8
13 changed files with 112 additions and 26 deletions
|
|
@ -6,6 +6,10 @@ Note that the only difference between `v2` and `v3` of the CodeQL Action is the
|
||||||
|
|
||||||
## [UNRELEASED]
|
## [UNRELEASED]
|
||||||
|
|
||||||
|
No user facing changes.
|
||||||
|
|
||||||
|
## 3.27.7 - 10 Dec 2024
|
||||||
|
|
||||||
- We are rolling out a change in December 2024 that will extract the CodeQL bundle directly to the toolcache to improve performance. [#2631](https://github.com/github/codeql-action/pull/2631)
|
- We are rolling out a change in December 2024 that will extract the CodeQL bundle directly to the toolcache to improve performance. [#2631](https://github.com/github/codeql-action/pull/2631)
|
||||||
- Fixed an issue where streaming the download and extraction of the CodeQL bundle did not respect proxy settings. [#2624](https://github.com/github/codeql-action/pull/2624)
|
- Fixed an issue where streaming the download and extraction of the CodeQL bundle did not respect proxy settings. [#2624](https://github.com/github/codeql-action/pull/2624)
|
||||||
- Update default CodeQL bundle version to 2.20.0. [#2636](https://github.com/github/codeql-action/pull/2636)
|
- Update default CodeQL bundle version to 2.20.0. [#2636](https://github.com/github/codeql-action/pull/2636)
|
||||||
|
|
|
||||||
28
lib/actions-util.js
generated
28
lib/actions-util.js
generated
|
|
@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.restoreInputs = exports.persistInputs = exports.CommandInvocationError = exports.getFileType = exports.FileCmdNotFoundError = exports.decodeGitFilePath = exports.getGitDiffHunkHeaders = exports.getAllGitMergeBases = exports.gitFetch = exports.deepenGitHistory = exports.determineBaseBranchHeadCommitOid = exports.getCommitOid = exports.getOptionalInput = exports.getRequiredInput = void 0;
|
exports.restoreInputs = exports.persistInputs = exports.CommandInvocationError = exports.getFileType = exports.FileCmdNotFoundError = exports.decodeGitFilePath = exports.getGitDiffHunkHeaders = exports.getAllGitMergeBases = exports.gitRepack = exports.gitFetch = exports.deepenGitHistory = exports.determineBaseBranchHeadCommitOid = exports.getCommitOid = exports.getOptionalInput = exports.getRequiredInput = void 0;
|
||||||
exports.getTemporaryDirectory = getTemporaryDirectory;
|
exports.getTemporaryDirectory = getTemporaryDirectory;
|
||||||
exports.getRef = getRef;
|
exports.getRef = getRef;
|
||||||
exports.getActionVersion = getActionVersion;
|
exports.getActionVersion = getActionVersion;
|
||||||
|
|
@ -183,14 +183,21 @@ const determineBaseBranchHeadCommitOid = async function (checkoutPathOverride) {
|
||||||
};
|
};
|
||||||
exports.determineBaseBranchHeadCommitOid = determineBaseBranchHeadCommitOid;
|
exports.determineBaseBranchHeadCommitOid = determineBaseBranchHeadCommitOid;
|
||||||
/**
|
/**
|
||||||
* Deepen the git history of the given ref by one level. Errors are logged.
|
* Deepen the git history of HEAD by one level. Errors are logged.
|
||||||
*
|
*
|
||||||
* This function uses the `checkout_path` to determine the repository path and
|
* This function uses the `checkout_path` to determine the repository path and
|
||||||
* works only when called from `analyze` or `upload-sarif`.
|
* works only when called from `analyze` or `upload-sarif`.
|
||||||
*/
|
*/
|
||||||
const deepenGitHistory = async function () {
|
const deepenGitHistory = async function () {
|
||||||
try {
|
try {
|
||||||
await runGitCommand((0, exports.getOptionalInput)("checkout_path"), ["fetch", "--no-tags", "--deepen=1"], "Cannot deepen the shallow repository.");
|
await runGitCommand((0, exports.getOptionalInput)("checkout_path"), [
|
||||||
|
"fetch",
|
||||||
|
"origin",
|
||||||
|
"HEAD",
|
||||||
|
"--no-tags",
|
||||||
|
"--no-recurse-submodules",
|
||||||
|
"--deepen=1",
|
||||||
|
], "Cannot deepen the shallow repository.");
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
// Errors are already logged by runGitCommand()
|
// Errors are already logged by runGitCommand()
|
||||||
|
|
@ -212,6 +219,21 @@ const gitFetch = async function (branch, extraFlags) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
exports.gitFetch = gitFetch;
|
exports.gitFetch = gitFetch;
|
||||||
|
/**
|
||||||
|
* Repack the git repository, using with the given flags. Errors are logged.
|
||||||
|
*
|
||||||
|
* This function uses the `checkout_path` to determine the repository path and
|
||||||
|
* works only when called from `analyze` or `upload-sarif`.
|
||||||
|
*/
|
||||||
|
const gitRepack = async function (flags) {
|
||||||
|
try {
|
||||||
|
await runGitCommand((0, exports.getOptionalInput)("checkout_path"), ["repack", ...flags], "Cannot repack the repository.");
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
// Errors are already logged by runGitCommand()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
exports.gitRepack = gitRepack;
|
||||||
/**
|
/**
|
||||||
* Compute the all merge bases between the given refs. Returns an empty array
|
* Compute the all merge bases between the given refs. Returns an empty array
|
||||||
* if no merge base is found, or if there is an error.
|
* if no merge base is found, or if there is an error.
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
11
lib/analyze.js
generated
11
lib/analyze.js
generated
|
|
@ -162,7 +162,7 @@ async function setupDiffInformedQueryRun(baseRef, headRef, codeql, logger, featu
|
||||||
if (!(await features.getValue(feature_flags_1.Feature.DiffInformedQueries, codeql))) {
|
if (!(await features.getValue(feature_flags_1.Feature.DiffInformedQueries, codeql))) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
return await (0, logging_1.withGroup)("Generating diff range extension pack", async () => {
|
return await (0, logging_1.withGroupAsync)("Generating diff range extension pack", async () => {
|
||||||
const diffRanges = await getPullRequestEditedDiffRanges(baseRef, headRef, logger);
|
const diffRanges = await getPullRequestEditedDiffRanges(baseRef, headRef, logger);
|
||||||
return writeDiffRangeDataExtensionPack(logger, diffRanges);
|
return writeDiffRangeDataExtensionPack(logger, diffRanges);
|
||||||
});
|
});
|
||||||
|
|
@ -185,7 +185,7 @@ async function getPullRequestEditedDiffRanges(baseRef, headRef, logger) {
|
||||||
}
|
}
|
||||||
// To compute the merge bases between the base branch and the PR topic branch,
|
// To compute the merge bases between the base branch and the PR topic branch,
|
||||||
// we need to fetch the commit graph from the branch heads to those merge
|
// we need to fetch the commit graph from the branch heads to those merge
|
||||||
// babes. The following 4-step procedure does so while limiting the amount of
|
// babes. The following 6-step procedure does so while limiting the amount of
|
||||||
// history fetched.
|
// history fetched.
|
||||||
// Step 1: Deepen from the PR merge commit to the base branch head and the PR
|
// Step 1: Deepen from the PR merge commit to the base branch head and the PR
|
||||||
// topic branch head, so that the PR merge commit is no longer considered a
|
// topic branch head, so that the PR merge commit is no longer considered a
|
||||||
|
|
@ -203,7 +203,12 @@ async function getPullRequestEditedDiffRanges(baseRef, headRef, logger) {
|
||||||
// Step 4: Fetch the base branch history, stopping when we reach commits that
|
// Step 4: Fetch the base branch history, stopping when we reach commits that
|
||||||
// are reachable from the PR topic branch head.
|
// are reachable from the PR topic branch head.
|
||||||
await actionsUtil.gitFetch(baseRef, [`--shallow-exclude=${headRef}`]);
|
await actionsUtil.gitFetch(baseRef, [`--shallow-exclude=${headRef}`]);
|
||||||
// Step 5: Deepen the history so that we have the merge bases between the base
|
// Step 5: Repack the history to remove the shallow grafts that were added by
|
||||||
|
// the previous fetches. This step works around a bug that causes subsequent
|
||||||
|
// deepening fetches to fail with "fatal: error in object: unshallow <SHA>".
|
||||||
|
// See https://stackoverflow.com/q/63878612
|
||||||
|
await actionsUtil.gitRepack(["-d"]);
|
||||||
|
// Step 6: Deepen the history so that we have the merge bases between the base
|
||||||
// branch and the PR topic branch.
|
// branch and the PR topic branch.
|
||||||
await actionsUtil.deepenGitHistory();
|
await actionsUtil.deepenGitHistory();
|
||||||
// To compute the exact same diff as GitHub would compute for the PR, we need
|
// To compute the exact same diff as GitHub would compute for the PR, we need
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
10
lib/logging.js
generated
10
lib/logging.js
generated
|
|
@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.getActionsLogger = getActionsLogger;
|
exports.getActionsLogger = getActionsLogger;
|
||||||
exports.getRunnerLogger = getRunnerLogger;
|
exports.getRunnerLogger = getRunnerLogger;
|
||||||
exports.withGroup = withGroup;
|
exports.withGroup = withGroup;
|
||||||
|
exports.withGroupAsync = withGroupAsync;
|
||||||
exports.formatDuration = formatDuration;
|
exports.formatDuration = formatDuration;
|
||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
function getActionsLogger() {
|
function getActionsLogger() {
|
||||||
|
|
@ -65,6 +66,15 @@ function withGroup(groupName, f) {
|
||||||
core.endGroup();
|
core.endGroup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
async function withGroupAsync(groupName, f) {
|
||||||
|
core.startGroup(groupName);
|
||||||
|
try {
|
||||||
|
return await f();
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
core.endGroup();
|
||||||
|
}
|
||||||
|
}
|
||||||
/** Format a duration for use in logs. */
|
/** Format a duration for use in logs. */
|
||||||
function formatDuration(durationMs) {
|
function formatDuration(durationMs) {
|
||||||
if (durationMs < 1000) {
|
if (durationMs < 1000) {
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../src/logging.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,4CAEC;AAED,0CAcC;AAED,8BAOC;AAGD,wCAWC;AAvDD,oDAAsC;AActC,SAAgB,gBAAgB;IAC9B,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAgB,eAAe,CAAC,SAAkB;IAChD,OAAO;QACL,sCAAsC;QACtC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,SAAS;QAClD,sCAAsC;QACtC,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,sCAAsC;QACtC,OAAO,EAAE,OAAO,CAAC,IAAI;QACrB,sCAAsC;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OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;IACrD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,UAAU,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAC9D,OAAO,GAAG,OAAO,IAAI,OAAO,GAAG,CAAC;AAClC,CAAC"}
|
||||||
2
node_modules/.package-lock.json
generated
vendored
2
node_modules/.package-lock.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "codeql",
|
"name": "codeql",
|
||||||
"version": "3.27.7",
|
"version": "3.27.8",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
|
|
|
||||||
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "codeql",
|
"name": "codeql",
|
||||||
"version": "3.27.7",
|
"version": "3.27.8",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "codeql",
|
"name": "codeql",
|
||||||
"version": "3.27.7",
|
"version": "3.27.8",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/artifact": "^2.1.9",
|
"@actions/artifact": "^2.1.9",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "codeql",
|
"name": "codeql",
|
||||||
"version": "3.27.7",
|
"version": "3.27.8",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "CodeQL action",
|
"description": "CodeQL action",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ export const determineBaseBranchHeadCommitOid = async function (
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deepen the git history of the given ref by one level. Errors are logged.
|
* Deepen the git history of HEAD by one level. Errors are logged.
|
||||||
*
|
*
|
||||||
* This function uses the `checkout_path` to determine the repository path and
|
* This function uses the `checkout_path` to determine the repository path and
|
||||||
* works only when called from `analyze` or `upload-sarif`.
|
* works only when called from `analyze` or `upload-sarif`.
|
||||||
|
|
@ -172,7 +172,14 @@ export const deepenGitHistory = async function () {
|
||||||
try {
|
try {
|
||||||
await runGitCommand(
|
await runGitCommand(
|
||||||
getOptionalInput("checkout_path"),
|
getOptionalInput("checkout_path"),
|
||||||
["fetch", "--no-tags", "--deepen=1"],
|
[
|
||||||
|
"fetch",
|
||||||
|
"origin",
|
||||||
|
"HEAD",
|
||||||
|
"--no-tags",
|
||||||
|
"--no-recurse-submodules",
|
||||||
|
"--deepen=1",
|
||||||
|
],
|
||||||
"Cannot deepen the shallow repository.",
|
"Cannot deepen the shallow repository.",
|
||||||
);
|
);
|
||||||
} catch {
|
} catch {
|
||||||
|
|
@ -198,6 +205,24 @@ export const gitFetch = async function (branch: string, extraFlags: string[]) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repack the git repository, using with the given flags. Errors are logged.
|
||||||
|
*
|
||||||
|
* This function uses the `checkout_path` to determine the repository path and
|
||||||
|
* works only when called from `analyze` or `upload-sarif`.
|
||||||
|
*/
|
||||||
|
export const gitRepack = async function (flags: string[]) {
|
||||||
|
try {
|
||||||
|
await runGitCommand(
|
||||||
|
getOptionalInput("checkout_path"),
|
||||||
|
["repack", ...flags],
|
||||||
|
"Cannot repack the repository.",
|
||||||
|
);
|
||||||
|
} catch {
|
||||||
|
// Errors are already logged by runGitCommand()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute the all merge bases between the given refs. Returns an empty array
|
* Compute the all merge bases between the given refs. Returns an empty array
|
||||||
* if no merge base is found, or if there is an error.
|
* if no merge base is found, or if there is an error.
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ import { addDiagnostic, makeDiagnostic } from "./diagnostics";
|
||||||
import { EnvVar } from "./environment";
|
import { EnvVar } from "./environment";
|
||||||
import { FeatureEnablement, Feature } from "./feature-flags";
|
import { FeatureEnablement, Feature } from "./feature-flags";
|
||||||
import { isScannedLanguage, Language } from "./languages";
|
import { isScannedLanguage, Language } from "./languages";
|
||||||
import { Logger, withGroup } from "./logging";
|
import { Logger, withGroupAsync } from "./logging";
|
||||||
import { DatabaseCreationTimings, EventReport } from "./status-report";
|
import { DatabaseCreationTimings, EventReport } from "./status-report";
|
||||||
import { ToolsFeature } from "./tools-features";
|
import { ToolsFeature } from "./tools-features";
|
||||||
import { endTracingForCluster } from "./tracer-config";
|
import { endTracingForCluster } from "./tracer-config";
|
||||||
|
|
@ -256,14 +256,17 @@ export async function setupDiffInformedQueryRun(
|
||||||
if (!(await features.getValue(Feature.DiffInformedQueries, codeql))) {
|
if (!(await features.getValue(Feature.DiffInformedQueries, codeql))) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
return await withGroup("Generating diff range extension pack", async () => {
|
return await withGroupAsync(
|
||||||
const diffRanges = await getPullRequestEditedDiffRanges(
|
"Generating diff range extension pack",
|
||||||
baseRef,
|
async () => {
|
||||||
headRef,
|
const diffRanges = await getPullRequestEditedDiffRanges(
|
||||||
logger,
|
baseRef,
|
||||||
);
|
headRef,
|
||||||
return writeDiffRangeDataExtensionPack(logger, diffRanges);
|
logger,
|
||||||
});
|
);
|
||||||
|
return writeDiffRangeDataExtensionPack(logger, diffRanges);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DiffThunkRange {
|
interface DiffThunkRange {
|
||||||
|
|
@ -295,7 +298,7 @@ async function getPullRequestEditedDiffRanges(
|
||||||
|
|
||||||
// To compute the merge bases between the base branch and the PR topic branch,
|
// To compute the merge bases between the base branch and the PR topic branch,
|
||||||
// we need to fetch the commit graph from the branch heads to those merge
|
// we need to fetch the commit graph from the branch heads to those merge
|
||||||
// babes. The following 4-step procedure does so while limiting the amount of
|
// babes. The following 6-step procedure does so while limiting the amount of
|
||||||
// history fetched.
|
// history fetched.
|
||||||
|
|
||||||
// Step 1: Deepen from the PR merge commit to the base branch head and the PR
|
// Step 1: Deepen from the PR merge commit to the base branch head and the PR
|
||||||
|
|
@ -314,7 +317,12 @@ async function getPullRequestEditedDiffRanges(
|
||||||
// Step 4: Fetch the base branch history, stopping when we reach commits that
|
// Step 4: Fetch the base branch history, stopping when we reach commits that
|
||||||
// are reachable from the PR topic branch head.
|
// are reachable from the PR topic branch head.
|
||||||
await actionsUtil.gitFetch(baseRef, [`--shallow-exclude=${headRef}`]);
|
await actionsUtil.gitFetch(baseRef, [`--shallow-exclude=${headRef}`]);
|
||||||
// Step 5: Deepen the history so that we have the merge bases between the base
|
// Step 5: Repack the history to remove the shallow grafts that were added by
|
||||||
|
// the previous fetches. This step works around a bug that causes subsequent
|
||||||
|
// deepening fetches to fail with "fatal: error in object: unshallow <SHA>".
|
||||||
|
// See https://stackoverflow.com/q/63878612
|
||||||
|
await actionsUtil.gitRepack(["-d"]);
|
||||||
|
// Step 6: Deepen the history so that we have the merge bases between the base
|
||||||
// branch and the PR topic branch.
|
// branch and the PR topic branch.
|
||||||
await actionsUtil.deepenGitHistory();
|
await actionsUtil.deepenGitHistory();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,18 @@ export function withGroup<T>(groupName: string, f: () => T): T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function withGroupAsync<T>(
|
||||||
|
groupName: string,
|
||||||
|
f: () => Promise<T>,
|
||||||
|
): Promise<T> {
|
||||||
|
core.startGroup(groupName);
|
||||||
|
try {
|
||||||
|
return await f();
|
||||||
|
} finally {
|
||||||
|
core.endGroup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Format a duration for use in logs. */
|
/** Format a duration for use in logs. */
|
||||||
export function formatDuration(durationMs: number) {
|
export function formatDuration(durationMs: number) {
|
||||||
if (durationMs < 1000) {
|
if (durationMs < 1000) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue