Skip to content

Commit 8a40722

Browse files
committed
ci: use Central Feed Services for release builds
Explicitly use Central Feed Services (CFS) feeds for NuGet packages by replacing the normal, nuget.org, config file in the repo root at the start of the build jobs. Run NuGetAuthenticate once at the start of each job that restores (Windows, macOS, Linux, and the .NET tool packaging job) so every subsequent dotnet restore/publish is authenticated. The release-stage NuGet publish job is unaffected: it pushes via the 1ES service connection rather than a restore. Assisted-by: Claude Opus 4.8 Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com>
1 parent 1b7bd49 commit 8a40722

2 files changed

Lines changed: 47 additions & 0 deletions

File tree

.azure-pipelines/nuget.config

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
This Nuget config file is only used in release builds to redirect all
4+
NuGet package sources to the Central Feed Services (CFS) feed.
5+
-->
6+
<configuration>
7+
<packageSources>
8+
<clear />
9+
<add key="CFS" value="https://pkgs.dev.azure.com/mseng/1ES/_packaging/1ES_PublicPackages/nuget/v3/index.json" />
10+
</packageSources>
11+
</configuration>

.azure-pipelines/release.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,15 @@ extends:
134134
artifactName: '${{ dim.runtime }}'
135135
steps:
136136
- checkout: self
137+
- task: CopyFiles@2
138+
displayName: 'Use Central Feed Services (CFS)'
139+
inputs:
140+
SourceFolder: '$(Build.SourcesDirectory)\.azure-pipelines'
141+
Contents: 'nuget.config'
142+
TargetFolder: '$(Build.SourcesDirectory)'
143+
Overwrite: true
144+
- task: NuGetAuthenticate@1
145+
displayName: 'Authenticate to NuGet feeds'
137146
- task: PowerShell@2
138147
displayName: 'Install .NET 10 SDK'
139148
inputs:
@@ -281,6 +290,15 @@ extends:
281290
artifactName: '${{ dim.runtime }}'
282291
steps:
283292
- checkout: self
293+
- task: CopyFiles@2
294+
displayName: 'Use Central Feed Services (CFS)'
295+
inputs:
296+
SourceFolder: '$(Build.SourcesDirectory)/.azure-pipelines'
297+
Contents: 'nuget.config'
298+
TargetFolder: '$(Build.SourcesDirectory)'
299+
Overwrite: true
300+
- task: NuGetAuthenticate@1
301+
displayName: 'Authenticate to NuGet feeds'
284302
- task: UseDotNet@2
285303
displayName: 'Use .NET 10 SDK'
286304
inputs:
@@ -422,6 +440,15 @@ extends:
422440
artifactName: '${{ dim.runtime }}'
423441
steps:
424442
- checkout: self
443+
- task: CopyFiles@2
444+
displayName: 'Use Central Feed Services (CFS)'
445+
inputs:
446+
SourceFolder: '$(Build.SourcesDirectory)/.azure-pipelines'
447+
Contents: 'nuget.config'
448+
TargetFolder: '$(Build.SourcesDirectory)'
449+
Overwrite: true
450+
- task: NuGetAuthenticate@1
451+
displayName: 'Authenticate to NuGet feeds'
425452
- task: UseDotNet@2
426453
displayName: 'Use .NET 10 SDK'
427454
inputs:
@@ -499,6 +526,15 @@ extends:
499526
artifactName: 'dotnet-tool'
500527
steps:
501528
- checkout: self
529+
- task: CopyFiles@2
530+
displayName: 'Use Central Feed Services (CFS)'
531+
inputs:
532+
SourceFolder: '$(Build.SourcesDirectory)/.azure-pipelines'
533+
Contents: 'nuget.config'
534+
TargetFolder: '$(Build.SourcesDirectory)'
535+
Overwrite: true
536+
- task: NuGetAuthenticate@1
537+
displayName: 'Authenticate to NuGet feeds'
502538
- task: UseDotNet@2
503539
displayName: 'Use .NET 10 SDK'
504540
inputs:

0 commit comments

Comments
 (0)