From 7cfce83a454f152fd3ef8e839cac6d96a3f1f15a Mon Sep 17 00:00:00 2001 From: adityapatwardhan <12820925+adityapatwardhan@users.noreply.github.com> Date: Thu, 5 Nov 2026 18:36:28 +0000 Subject: [PATCH] Fix module-only vPack build feed credentials Map secret feed credentials directly into the vPack and MSIX build environments, matching other build templates. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .pipelines/MSIXBundle-vPack-Official.yml | 2 +- .../templates/stages/PowerShell-vPack-Stages.yml | 3 +-- docs/building/internals.md | 2 ++ test/infrastructure/NugetConfig.Tests.ps1 | 15 +++++++++++++++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.pipelines/MSIXBundle-vPack-Official.yml b/.pipelines/MSIXBundle-vPack-Official.yml index ee16e1c00c9..beee7f6bc8a 100644 --- a/.pipelines/MSIXBundle-vPack-Official.yml +++ b/.pipelines/MSIXBundle-vPack-Official.yml @@ -274,9 +274,9 @@ extends: Write-Verbose -Verbose "Completed building PowerShell for '$env:BuildConfiguration' configuration" displayName: 'Build Windows Universal - $(Architecture)-$(BuildConfiguration) Symbols folder' env: + VSS_NUGET_EXTERNAL_FEED_ENDPOINTS: $(VSS_NUGET_EXTERNAL_FEED_ENDPOINTS) ${{ if eq(parameters.IsEarlyAccess, true) }}: __DOTNET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) - VSS_NUGET_EXTERNAL_FEED_ENDPOINTS: $(VSS_NUGET_EXTERNAL_FEED_ENDPOINTS) ob_restore_phase: true # Set ob_restore_phase to run this step before '🔒 Setup Signing' step. # Add CodeQL Finalize task right after your 'Build' step. diff --git a/.pipelines/templates/stages/PowerShell-vPack-Stages.yml b/.pipelines/templates/stages/PowerShell-vPack-Stages.yml index bf493192b81..fc24eb21c54 100644 --- a/.pipelines/templates/stages/PowerShell-vPack-Stages.yml +++ b/.pipelines/templates/stages/PowerShell-vPack-Stages.yml @@ -249,8 +249,7 @@ stages: displayName: Build Windows Universal - $(Architecture) -$(BuildConfiguration) Symbols folder env: __DOTNET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) - ${{ if eq(parameters.IsEarlyAccess, true) }}: - VSS_NUGET_EXTERNAL_FEED_ENDPOINTS: $(VSS_NUGET_EXTERNAL_FEED_ENDPOINTS) + VSS_NUGET_EXTERNAL_FEED_ENDPOINTS: $(VSS_NUGET_EXTERNAL_FEED_ENDPOINTS) ob_restore_phase: true # Set ob_restore_phase to run this step before '🔒 Setup Signing' step. - task: CodeQL3000Finalize@0 # Add CodeQL Finalize task right after your 'Build' step. diff --git a/docs/building/internals.md b/docs/building/internals.md index 0d3c0f7dcbf..14c4c9a0c2d 100644 --- a/docs/building/internals.md +++ b/docs/building/internals.md @@ -49,6 +49,8 @@ The flags can also be enabled together. The shared [`insert-nuget-config-azfeed.yml`](../../.pipelines/templates/insert-nuget-config-azfeed.yml) template installs the Azure Artifacts Credential Provider and supplies an Azure DevOps access token through the secret `VSS_NUGET_EXTERNAL_FEED_ENDPOINTS` variable. +Build steps must explicitly map this secret variable into their `env` block, +including module-only builds; Azure Pipelines does not automatically export secret variables. The `powershell-net-early-access` service connection identity must have read access to the module feed. The existing PowerShell feed continues to use its separate PAT. For local restores, install the Azure Artifacts Credential Provider and use diff --git a/test/infrastructure/NugetConfig.Tests.ps1 b/test/infrastructure/NugetConfig.Tests.ps1 index e5542bb9357..243bb166fb8 100644 --- a/test/infrastructure/NugetConfig.Tests.ps1 +++ b/test/infrastructure/NugetConfig.Tests.ps1 @@ -88,6 +88,21 @@ Describe 'Early-access module feeds' { } } + It 'Maps secret feed credentials directly into the build environment in ' -TestCases @( + @{ Pipeline = '.pipelines/templates/stages/PowerShell-vPack-Stages.yml' } + @{ Pipeline = '.pipelines/MSIXBundle-vPack-Official.yml' } + ) { + param($Pipeline) + + $template = Get-Content "$PSScriptRoot/../../$Pipeline" -Raw + $buildStep = [regex]::Match($template, '(?ms)^\s*displayName: [''"]?Build Windows Universal[^\r\n]*\r?\n(? +)env:\r?\n(?.*?)(?=^\k\S|\z)') + $buildStep.Success | Should -BeTrue + $envIndent = $buildStep.Groups['envIndent'].Value + ' ' + $buildStep.Groups['env'].Value | Should -Match ( + '(?m)^' + $envIndent + 'VSS_NUGET_EXTERNAL_FEED_ENDPOINTS: \$\(VSS_NUGET_EXTERNAL_FEED_ENDPOINTS\)\r?$' + ) + } + BeforeEach { $env:EARLY_ACCESS_FEED = 'net11' Mock New-NugetConfigFile -ModuleName build {}