Skip to content

Fix CodeQL pipeline to build all code without publishing#16135

Merged
joperezr merged 1 commit intomicrosoft:mainfrom
joperezr:fix-codeql-pipeline
Apr 16, 2026
Merged

Fix CodeQL pipeline to build all code without publishing#16135
joperezr merged 1 commit intomicrosoft:mainfrom
joperezr:fix-codeql-pipeline

Conversation

@joperezr
Copy link
Copy Markdown
Member

Summary

The CodeQL pipeline (definition 1599) has been failing on \main\ for several weeks. This PR fixes it.

Root Causes

  1. VSIX validation error (April 6 & 13): \cibuild.cmd\ hardwires -publish, which triggers publish validation in \Publishing.props\ that expects exactly 1 .vsix\ file. Since \BuildExtension\ defaults to \ alse, no VSIX was ever built.

  2. SDK resolution error (March 16–30): Stale
    elease/*\ branches referenced unavailable SDK versions.

Changes

  • *Replace \cibuild.cmd\ with \�uild.cmd -restore -build* — only restores and builds, no test execution, signing, packing, or publishing. All code (src, tests, playground, extension) is compiled so CodeQL can analyze it.
  • *Add /p:BuildExtension=true* + Node.js/yarn/vsce prerequisites — includes the VS Code extension in the build for CodeQL TypeScript analysis.
  • *Add /p:SkipNativeBuild=true* — skips native AOT CLI compilation (slow and not useful for CodeQL C#/TS analysis).
  • Narrow scheduled branches to \main\ and
    elease/13.2\ only (other release branches are stale).

Copilot AI review requested due to automatic review settings April 13, 2026 23:52
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 13, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16135

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16135"

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes the Azure DevOps CodeQL pipeline so it successfully compiles the full repo (including the VS Code extension) without triggering publishing/validation steps, enabling CodeQL analysis to run reliably on targeted branches.

Changes:

  • Narrow scheduled CodeQL runs to main and release/13.2.
  • Install Node.js + yarn + vsce to enable building the VS Code extension during the CodeQL build.
  • Replace cibuild.cmd invocation with build.cmd -restore -build plus MSBuild properties to build the extension and skip native build.

Comment on lines +80 to +86
- script: build.cmd
-restore -build
-configuration $(_BuildConfig)
-prepareMachine
/p:Test=false
displayName: Windows Build
-ci
/p:BuildExtension=true
/p:SkipNativeBuild=true
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

The script step is currently split across multiple YAML lines with the arguments indented less than the script: value, so Azure Pipelines will not treat them as part of the same command. As written, this is likely parsed as either invalid YAML or as separate step keys/sequence items, and build.cmd will run without the intended arguments (or -restore will be executed as a separate command). Please format this like other pipelines in the repo (indent args to align under the script value) or use script: |/script: > so build.cmd receives -restore -build -configuration ... in the same invocation.

Copilot uses AI. Check for mistakes.
@radical
Copy link
Copy Markdown
Member

radical commented Apr 14, 2026

Do we have a validation run for the pipeline?

@joperezr
Copy link
Copy Markdown
Member Author

@joperezr joperezr force-pushed the fix-codeql-pipeline branch from 6680b31 to 9c6074f Compare April 15, 2026 20:25
The CodeQL pipeline (definition 1599) has been failing on main for
weeks due to two issues:

1. cibuild.cmd hardwires -publish, which triggers VSIX validation in
   Publishing.props expecting a .vsix file that was never built
   (BuildExtension defaults to false).

2. Stale release/* branches with unavailable SDK versions.

Fix by:
- Using build.cmd with explicit -restore -build flags only (no -test,
  -sign, -pack, or -publish) so all code is compiled for CodeQL
  analysis without publishing artifacts.
- Adding /p:BuildExtension=true and Node.js/yarn/vsce prerequisites
  so the VS Code extension is included in the analysis.
- Adding /p:SkipNativeBuild=true to skip slow native AOT CLI builds
  that aren't useful for CodeQL C#/TS analysis.
- Narrowing scheduled branches to main and release/13.2 only.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@joperezr joperezr force-pushed the fix-codeql-pipeline branch from 9c6074f to 872eb31 Compare April 15, 2026 21:25
@joperezr joperezr merged commit 4c14b6e into microsoft:main Apr 16, 2026
278 of 281 checks passed
@github-actions github-actions bot added this to the 13.3 milestone Apr 16, 2026
@joperezr joperezr deleted the fix-codeql-pipeline branch April 16, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants