Skip to content

Consolidate CI pipeline jobs and add NuGet caching#8418

Open
bschnurr wants to merge 10 commits intomainfrom
test-build-fix
Open

Consolidate CI pipeline jobs and add NuGet caching#8418
bschnurr wants to merge 10 commits intomainfrom
test-build-fix

Conversation

@bschnurr
Copy link
Member

Problem

The pipeline was split into 4 separate jobs (build, installer, test, nuget) that each had to wait for a build machine, do a fresh checkout, restore packages, and install MicroBuild plugins. This caused:

  • VSSDK1025 build failure in the installer job — it downloaded only raw/binaries/ but the VSSDK CopyPkgDef target needs intermediate outputs from raw/obj/VCDebugLauncher/
  • Slow NuGet Package builds — the separate nuget job spent most of its time waiting for a build machine and duplicating setup work already done by the build job
  • Slow NuGet restores (~6 min) — 81 packages downloaded fresh every run with no caching

Changes

azure-pipelines.yml

  • Moved Installer & Bootstrapper back into the build job — fixes the VSSDK1025 pkgdef error since all intermediate outputs are already on disk; skipped on PR builds unless the buildInstaller parameter is set
  • Moved NuGet Package back into the build job — eliminates a separate job that had to wait for a machine, checkout, restore, install plugins, and download/copy binaries; skipped on PR builds unless PublishNugetPackageAsBuildArtifact is set
  • Added buildInstaller parameter (default: false) — allows opt-in installer builds on PR runs
  • Removed separate installer and nuget jobs — all work now runs in the single build job
  • Removed raw, Layout, and SBOM diagnostic artifact outputs — no longer needed

restore_packages.yml

  • Added NuGet HTTP cache — uses Cache@2 task keyed on packages.config content hash to cache the NuGet HTTP cache directory between runs, avoiding redundant package downloads

Net effect

  • Fewer jobs = fewer machine wait times and less duplicated setup (checkout, restore, MicroBuild install)
  • Installer builds correctly with all intermediate outputs available
  • Faster restores via NuGet HTTP caching

* copy layout files for installer build. enable all steps in PR for now

* add restore package
… error

Moved installer steps into the build job — BoM generation, installer build (Setup/dirs.proj), vsts drop upload, and bootstrapper creation now run as conditional steps inside the build job instead of a separate installer job. This fixes VSSDK1025: Could not find file 'raw\obj\VCDebugLauncher\*.pkgdef' caused by the separate job only downloading raw/binaries/ but missing intermediate outputs in raw/obj/.

Removed separate installer job — eliminates redundant checkout, microbuild install, package restore, artifact download/copy overhead.

Removed raw and SBOM artifact outputs — only existed for the installer job or diagnostics; saves storage.

Added package restore to nuget job — needed for MicroBuild.Core used by signing.

Temporarily enabled PublishNugetPackageAsBuildArtifact for PR builds.

Kept buildInstaller parameter — allows opt-in installer build on PR builds when manually queuing.
…parate nuget job has been removed. Here's what changed:

NuGet steps added to build job (lines 268-280) — build_nuget_package.yml template + PublishBuildArtifacts for the pkg artifact, under the condition ${{ if or(notin(variables['Build.Reason'], 'PullRequest'), eq(variables['PublishNugetPackageAsBuildArtifact'], true)) }}
Eliminated duplicate work — No more checkout, MicroBuild plugin install, package restore, binary download, or binary copy steps that the separate job required
Removed separate nuget job entirely — No more waiting for a build machine
@bschnurr bschnurr requested a review from a team as a code owner February 25, 2026 18:46
@bschnurr
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Updated restore_packages.yml to:
Add a Cache@2 step caching $(Pipeline.Workspace)/npm-cache (keyed on package.json + the pylance params).
Pass npm env vars into the Restore packages task so PreBuild.ps1’s npm install reuses cached downloads (npm_config_cache, npm_config_prefer_offline, and disables audit/fund/progress).
How to verify in CI

You should see a new step “Cache npm” with a hit/miss message.
On subsequent runs, the npm install part of “Restore packages” should download far less and run noticeably faster.
… node_modules when that switch is set.

Updated restore_packages.yml to:
Add a Cache node_modules step caching $(Build.SourcesDirectory)\node_modules (keyed on OS + package.json + pylance params).
Pass -preserveNodeModules when invoking PreBuild.ps1 in CI.
How to tell it’s working in the next run

“Cache node_modules” shows a cache hit on the second run.
In “Restore packages” logs you should see Preserving node_modules, and the Pylance portion should be much faster (often near-instant if versions didn’t change).
Caveat: node_modules cache can be large; if the cache service starts evicting or misses frequently, we can narrow it to @pylance (or similar) instead.
The NPM_CONFIG_CACHE error was because Windows env vars are case-insensitive, so Azure Pipelines treats npm_config_cache and NPM_CONFIG_CACHE as the same key and flags the second as a duplicate.

I removed NPM_CONFIG_CACHE from restore_packages.yml. npm_config_cache alone is enough.
The “stages parameter is not a valid StageList” was very likely a cascading template-expansion error caused by that duplicate env-var key. After removing it, both:

azure-pipelines.yml and
restore_packages.yml
parse cleanly as YAML locally.
@sonarqubecloud
Copy link

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.

1 participant