Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d1bdc0e
Create separate directory for overlay source code
henrymercer Feb 17, 2026
d28d996
Compute cache key for overlay language status
henrymercer Feb 17, 2026
69c2819
Add save and restore methods
henrymercer Feb 17, 2026
e275d63
Generalise status to multiple languages
henrymercer Feb 17, 2026
ebad062
Skip overlay analysis based on cached status
henrymercer Feb 17, 2026
96961e0
Save overlay status to Actions cache
henrymercer Feb 17, 2026
827bba6
Introduce feature flags for saving and checking status
henrymercer Feb 17, 2026
6c405c2
Be more explicit about attempt to build overlay DB
henrymercer Feb 17, 2026
0c47ae1
Sort doc URLs
henrymercer Feb 17, 2026
7b7a951
Add status page diagnostic when overlay skipped
henrymercer Feb 17, 2026
ef58c00
Only store overlay status if analysis failed
henrymercer Feb 17, 2026
cc0dce0
Improve diagnostic message wording
henrymercer Feb 17, 2026
d24014a
Tweak diagnostic message
henrymercer Feb 17, 2026
3dd1275
Improve error messages
henrymercer Feb 17, 2026
554b931
More error message improvements
henrymercer Feb 17, 2026
5c583bb
Include diagnostics in bundle
henrymercer Feb 17, 2026
05d4e25
Avoid mutating languages array in overlay status functions
henrymercer Feb 17, 2026
657f337
Add tests for shouldSkipOverlayAnalysis
henrymercer Feb 17, 2026
fa56ea8
Extract status file path helper
henrymercer Feb 17, 2026
898ae16
Improve log message
henrymercer Feb 17, 2026
4191f52
Address review comments
henrymercer Feb 19, 2026
4e71011
Add feature flag for more lenient overlay resource checks
henrymercer Feb 20, 2026
1847416
Merge pull request #3498 from github/henrymercer/overlay-resource-che…
henrymercer Feb 23, 2026
dc00a6f
Improve error message
henrymercer Feb 24, 2026
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
68 changes: 34 additions & 34 deletions lib/init-action-post.js

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

34 changes: 24 additions & 10 deletions lib/init-action.js

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

32 changes: 22 additions & 10 deletions src/config-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -768,14 +768,30 @@ export async function getOverlayDatabaseMode(
codeScanningConfig,
)
) {
const diskUsage = await checkDiskUsage(logger);
const performResourceChecks = !(await features.getValue(
Feature.OverlayAnalysisSkipResourceChecks,
codeql,
));
const checkOverlayStatus = await features.getValue(
Feature.OverlayAnalysisStatusCheck,
);
const diskUsage =
performResourceChecks || checkOverlayStatus
? await checkDiskUsage(logger)
: undefined;
if (
performResourceChecks &&
!(await runnerSupportsOverlayAnalysis(diskUsage, ramInput, logger))
) {
overlayDatabaseMode = OverlayDatabaseMode.None;
} else if (checkOverlayStatus && diskUsage === undefined) {
logger.warning(
`Unable to determine disk usage, therefore setting overlay database mode to ${OverlayDatabaseMode.None}.`,
);
overlayDatabaseMode = OverlayDatabaseMode.None;
} else if (
checkOverlayStatus &&
diskUsage &&
(await features.getValue(Feature.OverlayAnalysisStatusCheck)) &&
(await shouldSkipOverlayAnalysis(codeql, languages, diskUsage, logger))
) {
logger.info(
Expand All @@ -785,11 +801,6 @@ export async function getOverlayDatabaseMode(
);
overlayDatabaseMode = OverlayDatabaseMode.None;
skippedDueToCachedStatus = true;
} else if (
performResourceChecks &&
!(await runnerSupportsOverlayAnalysis(diskUsage, ramInput, logger))
) {
overlayDatabaseMode = OverlayDatabaseMode.None;
} else if (isAnalyzingPullRequest()) {
overlayDatabaseMode = OverlayDatabaseMode.Overlay;
useOverlayDatabaseCaching = true;
Expand Down Expand Up @@ -1046,14 +1057,15 @@ export async function initConfig(
config,
makeDiagnostic(
"codeql-action/overlay-skipped-due-to-cached-status",
"Skipped improved incremental analysis because it failed previously on this runner",
"Skipped improved incremental analysis because it failed previously with similar hardware resources",
{
attributes: {
languages: config.languages,
},
markdownMessage:
`Improved incremental analysis was skipped because it failed previously on this runner. ` +
"Improved incremental analysis may require a significant amount of disk space on some repositories. " +
`Improved incremental analysis was skipped because it previously failed for this repository ` +
`with CodeQL version ${(await inputs.codeql.getVersion()).version} on a runner with similar hardware resources. ` +
"Improved incremental analysis may require a significant amount of disk space for some repositories. " +
"If you want to enable improved incremental analysis, increase the disk space available " +
"to the runner. If that doesn't help, contact GitHub Support for further assistance.\n\n" +
"Improved incremental analysis will be automatically retried when the next version of CodeQL is released. " +
Expand Down
18 changes: 10 additions & 8 deletions src/init-action-post-helper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import * as uploadLib from "./upload-lib";
import * as util from "./util";
import * as workflow from "./workflow";

const NUM_BYTES_PER_GIB = 1024 * 1024 * 1024;

setupTests(test);

test("init-post action with debug mode off", async (t) => {
Expand Down Expand Up @@ -319,8 +321,8 @@ test("saves overlay status when overlay-base analysis did not complete successfu
delete process.env[EnvVar.ANALYZE_DID_COMPLETE_SUCCESSFULLY];

const diskUsage: util.DiskUsage = {
numAvailableBytes: 100 * 1024 * 1024 * 1024,
numTotalBytes: 200 * 1024 * 1024 * 1024,
numAvailableBytes: 100 * NUM_BYTES_PER_GIB,
numTotalBytes: 200 * NUM_BYTES_PER_GIB,
};
sinon.stub(util, "checkDiskUsage").resolves(diskUsage);

Expand Down Expand Up @@ -382,8 +384,8 @@ test("does not save overlay status when OverlayAnalysisStatusSave feature flag i
delete process.env[EnvVar.ANALYZE_DID_COMPLETE_SUCCESSFULLY];

sinon.stub(util, "checkDiskUsage").resolves({
numAvailableBytes: 100 * 1024 * 1024 * 1024,
numTotalBytes: 200 * 1024 * 1024 * 1024,
numAvailableBytes: 100 * NUM_BYTES_PER_GIB,
numTotalBytes: 200 * NUM_BYTES_PER_GIB,
});

const saveOverlayStatusStub = sinon
Expand Down Expand Up @@ -419,8 +421,8 @@ test("does not save overlay status when build successful", async (t) => {
process.env[EnvVar.ANALYZE_DID_COMPLETE_SUCCESSFULLY] = "true";

sinon.stub(util, "checkDiskUsage").resolves({
numAvailableBytes: 100 * 1024 * 1024 * 1024,
numTotalBytes: 200 * 1024 * 1024 * 1024,
numAvailableBytes: 100 * NUM_BYTES_PER_GIB,
numTotalBytes: 200 * NUM_BYTES_PER_GIB,
});

const saveOverlayStatusStub = sinon
Expand Down Expand Up @@ -455,8 +457,8 @@ test("does not save overlay status when overlay not enabled", async (t) => {
delete process.env[EnvVar.ANALYZE_DID_COMPLETE_SUCCESSFULLY];

sinon.stub(util, "checkDiskUsage").resolves({
numAvailableBytes: 100 * 1024 * 1024 * 1024,
numTotalBytes: 200 * 1024 * 1024 * 1024,
numAvailableBytes: 100 * NUM_BYTES_PER_GIB,
numTotalBytes: 200 * NUM_BYTES_PER_GIB,
});

const saveOverlayStatusStub = sinon
Expand Down
Loading
Loading