Skip to content

Route generation module installs through the private CFS feed (PS Gallery follow-up) [draft] - #3720

Draft
Gavin Barron (gavinbarron) wants to merge 1 commit into
mainfrom
gavinbarron/cfs-psgallery-private-feed
Draft

Route generation module installs through the private CFS feed (PS Gallery follow-up) [draft]#3720
Gavin Barron (gavinbarron) wants to merge 1 commit into
mainfrom
gavinbarron/cfs-psgallery-private-feed

Conversation

@gavinbarron

Copy link
Copy Markdown
Member

Draft — needs CI validation. Phase 2 follow-up to #3718 (which fixed the strict-tier registry.npmjs.org egress). This PR removes the CFSClean2-tier PowerShell Gallery egress in the generation pipelines 187 / 221 / 663.

Problem

Generation runs Install-Module/Find-Module against the public PowerShell Gallery (www.powershellgallery.com + cdn.powershellgallery.com), which trips CFSClean2. Telemetry (e.g. 221 build 230408, 663 build 232382) shows these hits in every workload generation job.

Approach

The private Azure Artifacts feed PowerShell_V2_Build already has a PowerShell Gallery upstream (confirmed via the feed's upstream sources), so it can serve both the internally published Graph modules and the public tooling modules (Pester, PlatyPS, powershell-yaml, PowerHTML). Route all generation module operations through it.

Changes

  • Process-wide token: add SYSTEM_ACCESSTOKEN: $(System.AccessToken) to variables: in weekly-generation.yml, command-metadata-refresh.yml, ci-build.yml — so credentials are available to every step and to the ForEach-Object -Parallel runspaces in GenerateModules.ps1.
  • install-tools.yml: new Register private module feed step registers PowerShell_V2_Build as a Trusted PSRepository (persisted for the job).
  • tools/Get-CfsFeedCredential.ps1 (new): shared helper — Get-CfsFeedName, Get-CfsFeedCredential (builds a PSCredential from SYSTEM_ACCESSTOKEN; returns $null locally so off-CI behaviour is unchanged), Register-CfsFeed.
  • Repoint sources from PSGalleryPowerShell_V2_Build, injecting the credential via $PSDefaultParameterValues (runspace-local, so it works inside parallel generation): ValidateUpdatedModuleVersion, GenerateRollUpModule, GenerateMetaModule, GenerateAuthenticationModule, BuildModule, Versions/BumpModuleVersion, and the ad-hoc tooling installs in GenerateHelp / TestModule / ImportExamples / UpdateOpenApi.

Validation (in CI)

  • Confirm www.powershellgallery.com / cdn.powershellgallery.com = 0 in the generation jobs (187/221/663).
  • Version-gate semantics: ValidateUpdatedModuleVersion now queries the private feed (PSGallery upstream) rather than public PSGallery directly — confirm the published-version comparison still gates correctly (the upstream proxies public versions, but the feed may also surface internally published versions).
  • Generation completes (modules build/pack) with modules resolved from the private feed.

Related

…hell Gallery follow-up)

Phase 2 of the PowerShell CFSClean remediation: eliminate the CFSClean2-tier egress to
www.powershellgallery.com / cdn.powershellgallery.com in the generation pipelines (187/221/663) by
routing every generation-time Install-Module/Find-Module through the private Azure Artifacts feed
PowerShell_V2_Build, which already has a PowerShell Gallery upstream (so it serves both the
internally published Graph modules and public tooling modules).

Mechanism:
- Expose $(System.AccessToken) as a process-wide SYSTEM_ACCESSTOKEN variable in weekly-generation.yml,
  command-metadata-refresh.yml and ci-build.yml, so credentials are available to every step and to
  the ForEach-Object -Parallel runspaces used by GenerateModules.ps1.
- install-tools.yml: new "Register private module feed" step registers PowerShell_V2_Build as a
  Trusted PSRepository (persisted for the job).
- tools/Get-CfsFeedCredential.ps1: shared helper (Get-CfsFeedName / Get-CfsFeedCredential /
  Register-CfsFeed) that builds a PSCredential from SYSTEM_ACCESSTOKEN; returns $null locally so
  behaviour is unchanged off-CI.
- Repoint sources from PSGallery to PowerShell_V2_Build and inject the credential via
  $PSDefaultParameterValues (runspace-local, so it works inside the parallel generation):
  ValidateUpdatedModuleVersion, GenerateRollUpModule, GenerateMetaModule,
  GenerateAuthenticationModule, BuildModule, Versions/BumpModuleVersion, plus the ad-hoc tooling
  installs (PlatyPS, Pester, powershell-yaml, PowerHTML) in GenerateHelp/TestModule/ImportExamples/
  UpdateOpenApi.

DRAFT: requires CI validation. Open questions to confirm in a pipeline run:
- ValidateUpdatedModuleVersion's version gate now queries the private feed (with PSGallery upstream)
  instead of public PSGallery directly; confirm the published-version comparison still behaves as
  intended (the upstream proxies public versions, but the feed may also expose internally published
  versions).
- Confirm www.powershellgallery.com / cdn.powershellgallery.com drop to 0 in the generation jobs.

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.

1 participant