From 8f3d1d8d017ec5ec083c9d331b2f9992c89bfe5b Mon Sep 17 00:00:00 2001 From: "Dustin L. Howett" Date: Thu, 29 Jan 2026 14:44:36 -0600 Subject: [PATCH] build: make the PGO build work again; upgrade nuget (#19810) Two main changes: - the build was failing for ARM64 because the build agents run out of memory downloading artifacts; this is a known issue that nobody cares to fix (and it pertains to using the x64 emulated agent host on native arm64 machines) - deleting the PDBs shrinks the build output by 2500MB :P - we had to switch to a new type of identity for publishing nuget packages to our cross-org feed I've verified that we get counts _and_ can even produce final PGO count packages for both architectures! --- build/pipelines/pgo.yml | 1 + .../job-pgo-build-nuget-and-publish.yml | 20 +++++++------------ .../templates-v2/job-run-pgo-tests.yml | 4 ++++ .../steps-ensure-nuget-version.yml | 11 +++++++--- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/build/pipelines/pgo.yml b/build/pipelines/pgo.yml index 4cb70875af..a62d41598e 100644 --- a/build/pipelines/pgo.yml +++ b/build/pipelines/pgo.yml @@ -50,6 +50,7 @@ stages: buildEverything: true pgoBuildMode: Instrument artifactStem: -instrumentation + keepAllExpensiveBuildOutputs: false # the ARM64 build agent runs out of memory downloading the artifacts... - stage: RunPGO displayName: Run PGO diff --git a/build/pipelines/templates-v2/job-pgo-build-nuget-and-publish.yml b/build/pipelines/templates-v2/job-pgo-build-nuget-and-publish.yml index 513e5c5007..295eeb7def 100644 --- a/build/pipelines/templates-v2/job-pgo-build-nuget-and-publish.yml +++ b/build/pipelines/templates-v2/job-pgo-build-nuget-and-publish.yml @@ -26,6 +26,7 @@ jobs: pgoToolsPath: $(Build.SourcesDirectory)\build\PGO nuspecPath: $(pgoToolsPath)\NuSpecs nuspecFilename: PGO.nuspec + nugetFeed: "https://pkgs.dev.azure.com/shine-oss/terminal/_packaging/TerminalDependencies/nuget/v3/index.json" steps: - checkout: self @@ -45,7 +46,8 @@ jobs: - task: NuGetAuthenticate@1 inputs: - nuGetServiceConnections: 'Terminal Public Artifact Feed' + azureDevOpsServiceConnection: 'Terminal Public Artifact Feed' + feedUrl: $(nugetFeed) # In the Microsoft Azure DevOps tenant, NuGetCommand is ambiguous. # This should be `task: NuGetCommand@2` @@ -68,15 +70,7 @@ jobs: artifact: pgo-nupkg-${{ parameters.buildConfiguration }}${{ parameters.artifactStem }} displayName: "Publish Pipeline Artifact" - - task: 333b11bd-d341-40d9-afcf-b32d5ce6f23b@2 - displayName: 'NuGet push' - inputs: - command: push - nuGetFeedType: external - packagesToPush: $(Build.ArtifactStagingDirectory)/*.nupkg - # The actual URL and PAT for this feed is configured at - # https://microsoft.visualstudio.com/Dart/_settings/adminservices - # This is the name of that connection - publishFeedCredentials: 'Terminal Public Artifact Feed' - feedsToUse: config - nugetConfigPath: '$(Build.SourcesDirectory)/NuGet.config' + - pwsh: |- + $nupkg = Get-Item "$(Build.ArtifactStagingDirectory)/*.nupkg" + & nuget push -ApiKey az -Source "$(nugetFeed)" "$nupkg" + displayName: NuGet push diff --git a/build/pipelines/templates-v2/job-run-pgo-tests.yml b/build/pipelines/templates-v2/job-run-pgo-tests.yml index 07d498016d..7cc3948250 100644 --- a/build/pipelines/templates-v2/job-run-pgo-tests.yml +++ b/build/pipelines/templates-v2/job-run-pgo-tests.yml @@ -45,6 +45,10 @@ jobs: displayName: Extract the unpackaged build for PGO - template: steps-ensure-nuget-version.yml + parameters: + ${{ if eq(parameters.buildPlatform, 'arm64') }}: + # The ARM64 agents do not seem to have NuGet installed + forceNugetInstallation: true - powershell: |- $Package = 'Microsoft.Internal.Windows.Terminal.TestContent' diff --git a/build/pipelines/templates-v2/steps-ensure-nuget-version.yml b/build/pipelines/templates-v2/steps-ensure-nuget-version.yml index ea5eda5557..c06429bf79 100644 --- a/build/pipelines/templates-v2/steps-ensure-nuget-version.yml +++ b/build/pipelines/templates-v2/steps-ensure-nuget-version.yml @@ -1,5 +1,10 @@ +parameters: + - name: forceNugetInstallation + type: boolean + default: false + steps: -- ${{ if eq(variables['System.CollectionId'], 'cb55739e-4afe-46a3-970f-1b49d8ee7564') }}: +- ${{ if and(ne(parameters.forceNugetInstallation, true), eq(variables['System.CollectionId'], 'cb55739e-4afe-46a3-970f-1b49d8ee7564')) }}: - pwsh: |- Write-Host "Assuming NuGet is already installed..." & nuget.exe help @@ -7,6 +12,6 @@ steps: - ${{ else }}: - task: NuGetToolInstaller@1 - displayName: Use NuGet 6.6.1 + displayName: Use NuGet 7.0.1 inputs: - versionSpec: 6.6.1 + versionSpec: 7.0.1