Skip to content

Force autorest cache pre-population onto the private npm feed (CFSClean) - #3697

Merged
Ramses Sanchez-Hernandez (ramsessanchez) merged 1 commit into
mainfrom
gavinbarron/cfs-prepopulate-registry
Aug 6, 2026
Merged

Force autorest cache pre-population onto the private npm feed (CFSClean)#3697
Ramses Sanchez-Hernandez (ramsessanchez) merged 1 commit into
mainfrom
gavinbarron/cfs-prepopulate-registry

Conversation

@gavinbarron

Copy link
Copy Markdown
Member

What

Fixes the residual CFSClean network-isolation violation on the PowerShell pipelines (187/221/663): 2 registry.npmjs.org requests per build that remained after the autorest --skip-upgrade-check fix (#3696).

Root cause

Traced from build telemetry + task logs: the 2 hits come from the "Pre-populate autorest extension cache" task. PrePopulateAutorestCache.ps1 runs:

npm install @autorest/core@3.10.4      --prefix <cacheDir>
npm install @autorest/modelerfour@4.24.3 --prefix <cacheDir>

With --prefix, npm did not honor the registry/auth in the authenticated ~/.npmrc (produced by install-tools.yml) and reached registry.npmjs.org directly — each npm install = 1 hit, 2 total. The task meant to prevent autorest's npm calls was itself the leak.

Change (tools/Utilities/PrePopulateAutorestCache.ps1)

Derive --userconfig and --registry from the authenticated ~/.npmrc and pass them explicitly to each npm install, so both installs use the PowerShell_V2_Build private feed (no hard-coded URL). Warn if ~/.npmrc is missing.

Notes

  • Complements Stop autorest upgrade-check from egressing to npmjs (CFSClean) #3696 (autorest core upgrade-check) — together these should clear the registry.npmjs.org CFSClean egress for 187/221/663.
  • The private feed already serves these packages (verified), so the installs will resolve through it.
  • Needs a validation run on main post-merge to confirm zero registry.npmjs.org hits.

Relates to S360 KPI 527fb616-07aa-8198-6419-50d04ef1c2f3 (1ES network isolation).

PrePopulateAutorestCache.ps1 runs 'npm install <ext> --prefix <dir>' for @autorest/core and @autorest/modelerfour. With --prefix, npm did not honor the registry/auth in ~/.npmrc and reached registry.npmjs.org directly (2 hits/build) - the residual CFSClean violation on pipeline 187 after the autorest --skip-upgrade-check fix (#3696). Pass --userconfig and --registry explicitly (read from the authenticated ~/.npmrc that install-tools.yml produced) so both installs use the PowerShell_V2_Build private feed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d3f8fec7-b00b-46be-ba39-7e1f3e7f7188
@gavinbarron
Gavin Barron (gavinbarron) requested a review from a team as a code owner August 6, 2026 17:42
@ramsessanchez
Ramses Sanchez-Hernandez (ramsessanchez) merged commit e29ebec into main Aug 6, 2026
4 of 7 checks passed
@ramsessanchez
Ramses Sanchez-Hernandez (ramsessanchez) deleted the gavinbarron/cfs-prepopulate-registry branch August 6, 2026 23:50
Ramses Sanchez-Hernandez (ramsessanchez) pushed a commit that referenced this pull request Aug 7, 2026
…-install (CFSClean) (#3703)

PR #3696/#3697 routed the autorest and Rush package registry to the private CFS feed, but pipeline 187 still showed 2 registry.npmjs.org hits during 'Rush Build'. Root cause: 'rush install' self-installs Rush and pnpm via 'npm install', and each runs 'npm audit', which POSTs to the public registry.npmjs.org audit endpoint (the private Azure Artifacts feed does not serve it) - 2 self-installs = 2 npmjs hits. Adding audit=false (and fund=false) to the .npmrc content written by Configure-PrivateNpmFeed.ps1 propagates through Rush's .npmrc transforms to those self-install npm calls, eliminating the egress. Verified via build 231003 log + network-isolation telemetry (hits during the Rush Build window, node.exe).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d3f8fec7-b00b-46be-ba39-7e1f3e7f7188
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.

2 participants