Add Azure Pipelines incremental CodeQL scanning template (overlay + diff-informed)#23
Draft
Copilot wants to merge 2 commits into
Draft
Add Azure Pipelines incremental CodeQL scanning template (overlay + diff-informed)#23Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
Copilot
AI
changed the title
[WIP] Create a sample showing CLI usage of CodeQL incremental scanning
Add Azure Pipelines incremental CodeQL scanning template (overlay + diff-informed)
Jun 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the incremental CodeQL analysis pattern for ADO pipelines, combining overlay analysis (reuse cached base DB, re-extract only changed files) with diff-informed analysis (restrict alert output to PR-changed lines). Can cut PR scan times by up to 10× on large codebases.
New file:
Azure Pipelines/Azure-Pipelines-template-linux-incremental.ymlBased on
Azure-Pipelines-template-linux.yml. Single pipeline YAML with two stages selected automatically by trigger:OverlayBaseScan--overlay-base; publishes DB + OID snapshot as pipeline artifactIncrementalPRScanStage 1 —
OverlayBaseScan(push to default branch)database init --overlay-base --db-cluster→database finalize(extraction for interpreted languages)database run-querieswithout--expect-discarded-cacheto preserve the overlay query cachedatabase cleanup --cache-cleanup=overlaybefore publishingcodeql-overlay-base-<language>pipeline artifact; uploads full SARIFStage 2 —
IncrementalPRScan(pull request)continueOnError: truefor fallback)overlay-changes.jsongit diff --unified=0 merge_base..HEADhunk headers → generatesqlpack.yml+pr-diff-range.ymlfeeding therestrictAlertsToextensible predicatedatabase init --overlay-changes+database finalize(re-extracts changed files only)database run-queries --additional-packs --extension-packs=my-ci/pr-diff-rangedatabase interpret-results --sarif-run-property=incrementalMode=overlay,diff-informedrestrictAlertsTois permissive, not guaranteed)database create+database analyze) when no overlay artifact is availableRequirements: CodeQL CLI Bundle 2.23.9+ (JS/Python/Ruby) or 2.23.8+ (other languages); Git 2.38.0+;
build-mode: noneonly (compiled languages except Go not supported by overlay).Updated:
Azure Pipelines/README.mdAdded entry for the new template with a trigger/behaviour summary table and requirements.