Skip to content

Commit 4e16ac6

Browse files
martinrrmCopilot
andcommitted
Build and publish NuGet.Client.EndToEnd.TestData 1.0.3 from CI
Adds an opt-in, queue-time `PublishEndToEndTestData` parameter to the official pipeline that builds the NuGet.Client.EndToEnd.TestData package and publishes it (with an SBOM) as the `EndToEndTestData` pipeline artifact. The companion NuGet.Client-Pipelines change downloads that artifact and pushes it to the public dnceng nuget-build feed. - Bump NuGet.Client.EndToEnd.TestData to 1.0.3 (nuspec + Directory.Packages.props pin). - Thread `PublishEndToEndTestData` through official.yml -> pipeline.yml -> Build.yml (default false; non-RTM, official builds only). - Generate the package into an isolated staging directory ($(Build.StagingDirectory)\e2etestdata), deliberately outside the repo 'artifacts' tree so it bypasses MicroBuild signing (SignTool would recurse into and corrupt the bundled mock-package fixtures), BAR/Maestro publishing, and the product SBOM scan; verify exactly one package is produced, then publish it as the `EndToEndTestData` artifact. - Update CreateTestDataPackage.ps1 to locate GenerateTestPackages.exe under both local and CI output layouts and to fail with a clearer error when it is missing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 989861b commit 4e16ac6

6 files changed

Lines changed: 85 additions & 3 deletions

File tree

Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
<PackageVersion Include="MSTest.TestAdapter" Version="$(MSTestPackageVersion)" />
8484
<PackageVersion Include="MSTest.TestFramework" Version="$(MSTestPackageVersion)" />
8585
<PackageVersion Include="Newtonsoft.Json" Version="$(NewtonsoftJsonPackageVersion)" />
86-
<PackageVersion Include="NuGet.Client.EndToEnd.TestData" Version="1.0.0" />
86+
<PackageVersion Include="NuGet.Client.EndToEnd.TestData" Version="1.0.3" />
8787
<PackageVersion Include="NuGet.Core" Version="2.14.0-rtm-832" />
8888
<PackageVersion Include="NuGetValidator" version="2.1.1" />
8989
<PackageVersion Include="SharpZipLib" Version="1.4.2" />

eng/pipelines/official.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ parameters:
1010
values:
1111
- Real
1212
- Test
13+
- name: PublishEndToEndTestData
14+
displayName: Publish EndToEnd TestData Package
15+
type: boolean
16+
default: false
1317

1418
resources:
1519
repositories:
@@ -56,3 +60,4 @@ extends:
5660
RunBuildForPublishing: ${{parameters.RunBuildForPublishing}}
5761
SigningType: ${{ parameters.SigningType }}
5862
TryRunOneLocBuild: true
63+
PublishEndToEndTestData: ${{ parameters.PublishEndToEndTestData }}

eng/pipelines/templates/Build.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ parameters:
44
- name: SigningType
55
displayName: Type of signing to use
66
type: string
7+
- name: PublishEndToEndTestData
8+
type: boolean
9+
default: false
710

811
steps:
912
- task: PowerShell@1
@@ -131,6 +134,50 @@ steps:
131134
configuration: "$(BuildConfiguration)"
132135
msbuildArguments: "/restore:false /target:Pack /property:BuildRTM=$(BuildRTM) /property:ExcludeTestProjects=$(BuildRTM) /property:BuildNumber=$(BuildNumber) /binarylogger:$(Build.StagingDirectory)\\binlog\\11.Pack.binlog /property:MicroBuild_SigningEnabled=false"
133136

137+
- ${{ if and(eq(parameters.PublishEndToEndTestData, true), not(parameters.BuildRTM)) }}:
138+
# The EndToEnd test data package bundles nested .nupkg fixtures as content. It is generated into a
139+
# staging directory that is deliberately OUTSIDE the repo 'artifacts' tree so it is never signed
140+
# (SignTool would recurse into and corrupt the nested fixtures), never picked up by BAR publishing,
141+
# and never scanned by the product SBOM. It is published unsigned to the dnceng nuget-build feed
142+
# via the '- output: nuget' block in pipeline.yml.
143+
- task: PowerShell@1
144+
displayName: "Prepare EndToEnd TestData output directory"
145+
condition: "succeeded()"
146+
inputs:
147+
scriptType: "inlineScript"
148+
inlineScript: |
149+
$dir = "$(Build.StagingDirectory)\e2etestdata"
150+
if (Test-Path $dir) { Remove-Item -Path $dir -Recurse -Force }
151+
New-Item -ItemType Directory -Path $dir -Force | Out-Null
152+
153+
- task: MSBuild@1
154+
displayName: "Build GenerateTestPackages"
155+
condition: "succeeded()"
156+
inputs:
157+
solution: "test\\TestExtensions\\GenerateTestPackages\\GenerateTestPackages.csproj"
158+
configuration: "$(BuildConfiguration)"
159+
msbuildArguments: "/restore:true /property:BuildNumber=$(BuildNumber) /binarylogger:$(Build.StagingDirectory)\\binlog\\GenerateTestPackages.binlog /property:MicroBuild_SigningEnabled=false"
160+
161+
- task: PowerShell@1
162+
displayName: "Generate EndToEnd TestData Package"
163+
condition: "succeeded()"
164+
inputs:
165+
scriptName: "$(Build.Repository.LocalPath)\\scripts\\e2etests\\CreateTestDataPackage.ps1"
166+
arguments: "-configuration '$(BuildConfiguration)' -outputDirectoryPath '$(Build.StagingDirectory)\\e2etestdata'"
167+
168+
- task: PowerShell@1
169+
displayName: "Verify EndToEnd TestData Package exists"
170+
condition: "succeeded()"
171+
inputs:
172+
scriptType: "inlineScript"
173+
inlineScript: |
174+
$packages = @(Get-ChildItem -Path "$(Build.StagingDirectory)\e2etestdata\NuGet.Client.EndToEnd.TestData.*.nupkg" -ErrorAction SilentlyContinue)
175+
if ($packages.Count -ne 1) {
176+
Write-Host "##vso[task.LogIssue type=error;]Expected exactly one NuGet.Client.EndToEnd.TestData package, but found $($packages.Count)."
177+
exit 1
178+
}
179+
Write-Host "Found EndToEnd TestData package: $($packages[0].Name)"
180+
134181
- task: PowerShell@1
135182
displayName: "Check expected packages exist for publishing"
136183
name: "EnsureAllPackagesExist"

eng/pipelines/templates/pipeline.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ parameters:
1616
values:
1717
- Real
1818
- Test
19+
- name: PublishEndToEndTestData
20+
displayName: Publish EndToEnd TestData Package
21+
type: boolean
22+
default: false
1923

2024
stages:
2125
- stage: Initialize
@@ -183,11 +187,24 @@ stages:
183187
targetPath: "$(Build.StagingDirectory)/sbom"
184188
sbomEnabled: false
185189

190+
# Publishes the generated EndToEnd test data package (and its SBOM) as a pipeline artifact. The
191+
# NuGet.Client-Release pipeline downloads this artifact and pushes it to the public dnceng nuget-build
192+
# feed. The package is generated into $(Build.StagingDirectory)\e2etestdata by Build.yml (outside the
193+
# signed/BAR/product-SBOM artifacts tree).
194+
- ${{ if eq(parameters.PublishEndToEndTestData, true) }}:
195+
- output: pipelineArtifact
196+
displayName: 'Publish EndToEnd TestData package'
197+
condition: "and(succeeded(), eq(variables['BuildRTM'], 'false'), eq(variables['IsOfficialBuild'], 'true'))"
198+
targetPath: '$(Build.StagingDirectory)\e2etestdata'
199+
artifactName: 'EndToEndTestData'
200+
sbomBuildDropPath: '$(Build.StagingDirectory)\e2etestdata'
201+
186202
steps:
187203
- template: /eng/pipelines/templates/Build.yml@self
188204
parameters:
189205
BuildRTM: false
190206
SigningType: ${{ parameters.SigningType }}
207+
PublishEndToEndTestData: ${{ parameters.PublishEndToEndTestData }}
191208

192209
- stage: Build_For_Publishing
193210
displayName: Build NuGet published to nuget.org
@@ -250,6 +267,7 @@ stages:
250267
parameters:
251268
BuildRTM: true
252269
SigningType: ${{ parameters.SigningType }}
270+
PublishEndToEndTestData: ${{ parameters.PublishEndToEndTestData }}
253271

254272
- ${{ if eq(parameters.isOfficialBuild, true) }}:
255273
- template: /eng/common/templates-official/post-build/post-build.yml

scripts/e2etests/CreateTestDataPackage.ps1

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,19 @@ Function Get-File([string[]] $pathParts)
5858

5959
Function Get-GenerateTestPackagesFile()
6060
{
61-
Return Get-File($repositoryRootDirectoryPath, 'artifacts', 'GenerateTestPackages', "$toolsetVersion.0", 'bin', $configuration, 'net472', 'GenerateTestPackages.exe')
61+
$filePathWithToolset = [System.IO.Path]::Combine($repositoryRootDirectoryPath, 'artifacts', 'GenerateTestPackages', "$toolsetVersion.0", 'bin', $configuration, 'net472', 'GenerateTestPackages.exe')
62+
if (Test-Path $filePathWithToolset)
63+
{
64+
Return [System.IO.FileInfo]::new($filePathWithToolset)
65+
}
66+
67+
$filePathWithoutToolset = [System.IO.Path]::Combine($repositoryRootDirectoryPath, 'artifacts', 'GenerateTestPackages', 'bin', $configuration, 'net472', 'GenerateTestPackages.exe')
68+
if (Test-Path $filePathWithoutToolset)
69+
{
70+
Return [System.IO.FileInfo]::new($filePathWithoutToolset)
71+
}
72+
73+
throw [System.IO.FileNotFoundException]::new("Could not find GenerateTestPackages.exe. Please build first. Probed:`n $filePathWithToolset`n $filePathWithoutToolset", $filePathWithoutToolset)
6274
}
6375

6476
Function Get-NuGetFile()

test/EndToEnd/NuGet.Client.EndToEnd.TestData.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
33
<metadata>
44
<id>NuGet.Client.EndToEnd.TestData</id>
5-
<version>1.0.0</version>
5+
<version>1.0.3</version>
66
<title>Test data for NuGet.Client EndToEnd tests</title>
77
<authors>Microsoft</authors>
88
<owners>Microsoft</owners>

0 commit comments

Comments
 (0)