diff --git a/Directory.Packages.props b/Directory.Packages.props index 2fff11d2ec9..655a4c23bde 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -83,7 +83,7 @@ - + diff --git a/eng/pipelines/official.yml b/eng/pipelines/official.yml index 818d0022276..5ce8302c410 100644 --- a/eng/pipelines/official.yml +++ b/eng/pipelines/official.yml @@ -10,6 +10,10 @@ parameters: values: - Real - Test +- name: PublishEndToEndTestData + displayName: Publish EndToEnd TestData Package + type: boolean + default: false resources: repositories: @@ -56,3 +60,4 @@ extends: RunBuildForPublishing: ${{parameters.RunBuildForPublishing}} SigningType: ${{ parameters.SigningType }} TryRunOneLocBuild: true + PublishEndToEndTestData: ${{ parameters.PublishEndToEndTestData }} diff --git a/eng/pipelines/templates/Build.yml b/eng/pipelines/templates/Build.yml index 6d1d0ea75a1..de1d7bc8d43 100644 --- a/eng/pipelines/templates/Build.yml +++ b/eng/pipelines/templates/Build.yml @@ -4,6 +4,9 @@ parameters: - name: SigningType displayName: Type of signing to use type: string + - name: PublishEndToEndTestData + type: boolean + default: false steps: - task: PowerShell@1 @@ -131,6 +134,50 @@ steps: configuration: "$(BuildConfiguration)" 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" + - ${{ if and(eq(parameters.PublishEndToEndTestData, true), not(parameters.BuildRTM)) }}: + # The EndToEnd test data package bundles nested .nupkg fixtures as content. It is generated into a + # staging directory that is deliberately OUTSIDE the repo 'artifacts' tree so it is never signed + # (SignTool would recurse into and corrupt the nested fixtures), never picked up by BAR publishing, + # and never scanned by the product SBOM. It is published unsigned to the dnceng nuget-build feed + # via the '- output: nuget' block in pipeline.yml. + - task: PowerShell@1 + displayName: "Prepare EndToEnd TestData output directory" + condition: "succeeded()" + inputs: + scriptType: "inlineScript" + inlineScript: | + $dir = "$(Build.StagingDirectory)\e2etestdata" + if (Test-Path $dir) { Remove-Item -Path $dir -Recurse -Force } + New-Item -ItemType Directory -Path $dir -Force | Out-Null + + - task: MSBuild@1 + displayName: "Build GenerateTestPackages" + condition: "succeeded()" + inputs: + solution: "test\\TestExtensions\\GenerateTestPackages\\GenerateTestPackages.csproj" + configuration: "$(BuildConfiguration)" + msbuildArguments: "/restore:true /property:BuildNumber=$(BuildNumber) /binarylogger:$(Build.StagingDirectory)\\binlog\\GenerateTestPackages.binlog /property:MicroBuild_SigningEnabled=false" + + - task: PowerShell@1 + displayName: "Generate EndToEnd TestData Package" + condition: "succeeded()" + inputs: + scriptName: "$(Build.Repository.LocalPath)\\scripts\\e2etests\\CreateTestDataPackage.ps1" + arguments: "-configuration '$(BuildConfiguration)' -outputDirectoryPath '$(Build.StagingDirectory)\\e2etestdata'" + + - task: PowerShell@1 + displayName: "Verify EndToEnd TestData Package exists" + condition: "succeeded()" + inputs: + scriptType: "inlineScript" + inlineScript: | + $packages = @(Get-ChildItem -Path "$(Build.StagingDirectory)\e2etestdata\NuGet.Client.EndToEnd.TestData.*.nupkg" -ErrorAction SilentlyContinue) + if ($packages.Count -ne 1) { + Write-Host "##vso[task.LogIssue type=error;]Expected exactly one NuGet.Client.EndToEnd.TestData package, but found $($packages.Count)." + exit 1 + } + Write-Host "Found EndToEnd TestData package: $($packages[0].Name)" + - task: PowerShell@1 displayName: "Check expected packages exist for publishing" name: "EnsureAllPackagesExist" diff --git a/eng/pipelines/templates/pipeline.yml b/eng/pipelines/templates/pipeline.yml index c4e2c011b92..9e0a4aa7784 100644 --- a/eng/pipelines/templates/pipeline.yml +++ b/eng/pipelines/templates/pipeline.yml @@ -16,6 +16,10 @@ parameters: values: - Real - Test +- name: PublishEndToEndTestData + displayName: Publish EndToEnd TestData Package + type: boolean + default: false stages: - stage: Initialize @@ -183,11 +187,24 @@ stages: targetPath: "$(Build.StagingDirectory)/sbom" sbomEnabled: false + # Publishes the generated EndToEnd test data package (and its SBOM) as a pipeline artifact. The + # NuGet.Client-Release pipeline downloads this artifact and pushes it to the public dnceng nuget-build + # feed. The package is generated into $(Build.StagingDirectory)\e2etestdata by Build.yml (outside the + # signed/BAR/product-SBOM artifacts tree). + - ${{ if eq(parameters.PublishEndToEndTestData, true) }}: + - output: pipelineArtifact + displayName: 'Publish EndToEnd TestData package' + condition: "and(succeeded(), eq(variables['BuildRTM'], 'false'), eq(variables['IsOfficialBuild'], 'true'))" + targetPath: '$(Build.StagingDirectory)\e2etestdata' + artifactName: 'EndToEndTestData' + sbomBuildDropPath: '$(Build.StagingDirectory)\e2etestdata' + steps: - template: /eng/pipelines/templates/Build.yml@self parameters: BuildRTM: false SigningType: ${{ parameters.SigningType }} + PublishEndToEndTestData: ${{ parameters.PublishEndToEndTestData }} - stage: Build_For_Publishing displayName: Build NuGet published to nuget.org @@ -250,6 +267,7 @@ stages: parameters: BuildRTM: true SigningType: ${{ parameters.SigningType }} + PublishEndToEndTestData: ${{ parameters.PublishEndToEndTestData }} - ${{ if eq(parameters.isOfficialBuild, true) }}: - template: /eng/common/templates-official/post-build/post-build.yml diff --git a/scripts/e2etests/CreateTestDataPackage.ps1 b/scripts/e2etests/CreateTestDataPackage.ps1 index 97650973b6e..0d93e8dc29d 100644 --- a/scripts/e2etests/CreateTestDataPackage.ps1 +++ b/scripts/e2etests/CreateTestDataPackage.ps1 @@ -58,7 +58,19 @@ Function Get-File([string[]] $pathParts) Function Get-GenerateTestPackagesFile() { - Return Get-File($repositoryRootDirectoryPath, 'artifacts', 'GenerateTestPackages', "$toolsetVersion.0", 'bin', $configuration, 'net472', 'GenerateTestPackages.exe') + $filePathWithToolset = [System.IO.Path]::Combine($repositoryRootDirectoryPath, 'artifacts', 'GenerateTestPackages', "$toolsetVersion.0", 'bin', $configuration, 'net472', 'GenerateTestPackages.exe') + if (Test-Path $filePathWithToolset) + { + Return [System.IO.FileInfo]::new($filePathWithToolset) + } + + $filePathWithoutToolset = [System.IO.Path]::Combine($repositoryRootDirectoryPath, 'artifacts', 'GenerateTestPackages', 'bin', $configuration, 'net472', 'GenerateTestPackages.exe') + if (Test-Path $filePathWithoutToolset) + { + Return [System.IO.FileInfo]::new($filePathWithoutToolset) + } + + throw [System.IO.FileNotFoundException]::new("Could not find GenerateTestPackages.exe. Please build first. Probed:`n $filePathWithToolset`n $filePathWithoutToolset", $filePathWithoutToolset) } Function Get-NuGetFile() diff --git a/test/EndToEnd/NuGet.Client.EndToEnd.TestData.nuspec b/test/EndToEnd/NuGet.Client.EndToEnd.TestData.nuspec index aa706ea24be..6a2510a650c 100644 --- a/test/EndToEnd/NuGet.Client.EndToEnd.TestData.nuspec +++ b/test/EndToEnd/NuGet.Client.EndToEnd.TestData.nuspec @@ -2,7 +2,7 @@ NuGet.Client.EndToEnd.TestData - 1.0.0 + 1.0.3 Test data for NuGet.Client EndToEnd tests Microsoft Microsoft diff --git a/test/EndToEnd/Packages/InstallPackagesConfigLocal/InstallPackagesConfigLocalGraph.dgml b/test/EndToEnd/Packages/InstallPackagesConfigLocal/InstallPackagesConfigLocalGraph.dgml new file mode 100644 index 00000000000..eaad2bdb9d6 --- /dev/null +++ b/test/EndToEnd/Packages/InstallPackagesConfigLocal/InstallPackagesConfigLocalGraph.dgml @@ -0,0 +1,13 @@ + + + + + + + + + + + + +