Skip to content

Commit 7de8a28

Browse files
Merged PR 42869: [internal/release/6.0.4xx] Merge from public
Merge from public release/6.0.4xx to internal/release/6.0.4xx and resolve conflicts if necessary ---- #### AI description (iteration 1) #### PR Classification Code cleanup and script updates. #### PR Summary This pull request merges changes from the public repository, focusing on cleaning up and updating post-build scripts. - Added `nuget-verification.ps1` to verify Microsoft NuGet packages. - Removed `post-build-utils.ps1`, `trigger-subscriptions.ps1`, and `add-build-to-channel.ps1` scripts. - Updated `publish-build-assets.yml` and `setup-maestro-vars.yml` to use `AzureCLI@2` instead of `PowerShell@2`. - Modified `nuget-validation.ps1` to use the new `nuget-verification.ps1` script. - Updated `publish-using-darc.ps1` to include `--ci` parameter and use `$AzdoToken` and `$MaestroApiEndPoint` securely.
2 parents 6b187a9 + 28e634f commit 7de8a28

24 files changed

+225
-341
lines changed

eng/Version.Details.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@
5757
</Dependency>
5858
</ProductDependencies>
5959
<ToolsetDependencies>
60-
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="6.0.0-beta.24360.7">
60+
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="6.0.0-beta.24459.5">
6161
<Uri>https://github.com/dotnet/arcade</Uri>
62-
<Sha>fbc993a9e8fb4926ce04c95ba2e48852c9d9df65</Sha>
62+
<Sha>685008547318b269dbbb82cfc9ca968126301bbe</Sha>
6363
<SourceBuild RepoName="arcade" ManagedOnly="true" />
6464
</Dependency>
6565
</ToolsetDependencies>

eng/Versions.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<PropertyGroup>
55
<UsingToolXliff>true</UsingToolXliff>
66
<UsingToolNetFrameworkReferenceAssemblies>true</UsingToolNetFrameworkReferenceAssemblies>
7-
<VersionPrefix>6.0.425</VersionPrefix>
7+
<VersionPrefix>6.0.427</VersionPrefix>
88
<PreReleaseVersionLabel>rtm</PreReleaseVersionLabel>
99
<!--
1010
When StabilizePackageVersion is set to 'true', this branch will produce stable outputs for 'Shipping' packages

eng/common/post-build/add-build-to-channel.ps1

-48
This file was deleted.

eng/common/post-build/check-channel-consistency.ps1

+9-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@ param(
44
)
55

66
try {
7-
. $PSScriptRoot\post-build-utils.ps1
7+
$ErrorActionPreference = 'Stop'
8+
Set-StrictMode -Version 2.0
9+
10+
# `tools.ps1` checks $ci to perform some actions. Since the post-build
11+
# scripts don't necessarily execute in the same agent that run the
12+
# build.ps1/sh script this variable isn't automatically set.
13+
$ci = $true
14+
$disableConfigureToolsetImport = $true
15+
. $PSScriptRoot\..\tools.ps1
816

917
if ($PromoteToChannels -eq "") {
1018
Write-PipelineTaskError -Type 'warning' -Message "This build won't publish assets as it's not configured to any Maestro channel. If that wasn't intended use Darc to configure a default channel using add-default-channel for this branch or to promote it to a channel using add-build-to-channel. See https://github.com/dotnet/arcade/blob/master/Documentation/Darc.md#assigning-an-individual-build-to-a-channel for more info."

eng/common/post-build/nuget-validation.ps1

+2-11
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,11 @@
22
# tool: https://github.com/NuGet/NuGetGallery/tree/jver-verify/src/VerifyMicrosoftPackage
33

44
param(
5-
[Parameter(Mandatory=$true)][string] $PackagesPath, # Path to where the packages to be validated are
6-
[Parameter(Mandatory=$true)][string] $ToolDestinationPath # Where the validation tool should be downloaded to
5+
[Parameter(Mandatory=$true)][string] $PackagesPath # Path to where the packages to be validated are
76
)
87

98
try {
10-
. $PSScriptRoot\post-build-utils.ps1
11-
12-
$url = 'https://raw.githubusercontent.com/NuGet/NuGetGallery/3e25ad135146676bcab0050a516939d9958bfa5d/src/VerifyMicrosoftPackage/verify.ps1'
13-
14-
New-Item -ItemType 'directory' -Path ${ToolDestinationPath} -Force
15-
16-
Invoke-WebRequest $url -OutFile ${ToolDestinationPath}\verify.ps1
17-
18-
& ${ToolDestinationPath}\verify.ps1 ${PackagesPath}\*.nupkg
9+
& $PSScriptRoot\nuget-verification.ps1 ${PackagesPath}\*.nupkg
1910
}
2011
catch {
2112
Write-Host $_.ScriptStackTrace
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
<#
2+
.SYNOPSIS
3+
Verifies that Microsoft NuGet packages have proper metadata.
4+
.DESCRIPTION
5+
Downloads a verification tool and runs metadata validation on the provided NuGet packages. This script writes an
6+
error if any of the provided packages fail validation. All arguments provided to this PowerShell script that do not
7+
match PowerShell parameters are passed on to the verification tool downloaded during the execution of this script.
8+
.PARAMETER NuGetExePath
9+
The path to the nuget.exe binary to use. If not provided, nuget.exe will be downloaded into the -DownloadPath
10+
directory.
11+
.PARAMETER PackageSource
12+
The package source to use to download the verification tool. If not provided, nuget.org will be used.
13+
.PARAMETER DownloadPath
14+
The directory path to download the verification tool and nuget.exe to. If not provided,
15+
%TEMP%\NuGet.VerifyNuGetPackage will be used.
16+
.PARAMETER args
17+
Arguments that will be passed to the verification tool.
18+
.EXAMPLE
19+
PS> .\verify.ps1 *.nupkg
20+
Verifies the metadata of all .nupkg files in the currect working directory.
21+
.EXAMPLE
22+
PS> .\verify.ps1 --help
23+
Displays the help text of the downloaded verifiction tool.
24+
.LINK
25+
https://github.com/NuGet/NuGetGallery/blob/master/src/VerifyMicrosoftPackage/README.md
26+
#>
27+
28+
# This script was copied from https://github.com/NuGet/NuGetGallery/blob/3e25ad135146676bcab0050a516939d9958bfa5d/src/VerifyMicrosoftPackage/verify.ps1
29+
30+
[CmdletBinding(PositionalBinding = $false)]
31+
param(
32+
[string]$NuGetExePath,
33+
[string]$PackageSource = "https://api.nuget.org/v3/index.json",
34+
[string]$DownloadPath,
35+
[Parameter(ValueFromRemainingArguments = $true)]
36+
[string[]]$args
37+
)
38+
39+
# The URL to download nuget.exe.
40+
$nugetExeUrl = "https://dist.nuget.org/win-x86-commandline/v4.9.4/nuget.exe"
41+
42+
# The package ID of the verification tool.
43+
$packageId = "NuGet.VerifyMicrosoftPackage"
44+
45+
# The location that nuget.exe and the verification tool will be downloaded to.
46+
if (!$DownloadPath) {
47+
$DownloadPath = (Join-Path $env:TEMP "NuGet.VerifyMicrosoftPackage")
48+
}
49+
50+
$fence = New-Object -TypeName string -ArgumentList '=', 80
51+
52+
# Create the download directory, if it doesn't already exist.
53+
if (!(Test-Path $DownloadPath)) {
54+
New-Item -ItemType Directory $DownloadPath | Out-Null
55+
}
56+
Write-Host "Using download path: $DownloadPath"
57+
58+
if ($NuGetExePath) {
59+
$nuget = $NuGetExePath
60+
} else {
61+
$downloadedNuGetExe = Join-Path $DownloadPath "nuget.exe"
62+
63+
# Download nuget.exe, if it doesn't already exist.
64+
if (!(Test-Path $downloadedNuGetExe)) {
65+
Write-Host "Downloading nuget.exe from $nugetExeUrl..."
66+
$ProgressPreference = 'SilentlyContinue'
67+
try {
68+
Invoke-WebRequest $nugetExeUrl -OutFile $downloadedNuGetExe
69+
$ProgressPreference = 'Continue'
70+
} catch {
71+
$ProgressPreference = 'Continue'
72+
Write-Error $_
73+
Write-Error "nuget.exe failed to download."
74+
exit
75+
}
76+
}
77+
78+
$nuget = $downloadedNuGetExe
79+
}
80+
81+
Write-Host "Using nuget.exe path: $nuget"
82+
Write-Host " "
83+
84+
# Download the latest version of the verification tool.
85+
Write-Host "Downloading the latest version of $packageId from $packageSource..."
86+
Write-Host $fence
87+
& $nuget install $packageId `
88+
-Prerelease `
89+
-OutputDirectory $DownloadPath `
90+
-Source $PackageSource
91+
Write-Host $fence
92+
Write-Host " "
93+
94+
if ($LASTEXITCODE -ne 0) {
95+
Write-Error "nuget.exe failed to fetch the verify tool."
96+
exit
97+
}
98+
99+
# Find the most recently downloaded tool
100+
Write-Host "Finding the most recently downloaded verification tool."
101+
$verifyProbePath = Join-Path $DownloadPath "$packageId.*"
102+
$verifyPath = Get-ChildItem -Path $verifyProbePath -Directory `
103+
| Sort-Object -Property LastWriteTime -Descending `
104+
| Select-Object -First 1
105+
$verify = Join-Path $verifyPath "tools\NuGet.VerifyMicrosoftPackage.exe"
106+
Write-Host "Using verification tool: $verify"
107+
Write-Host " "
108+
109+
# Execute the verification tool.
110+
Write-Host "Executing the verify tool..."
111+
Write-Host $fence
112+
& $verify $args
113+
Write-Host $fence
114+
Write-Host " "
115+
116+
# Respond to the exit code.
117+
if ($LASTEXITCODE -ne 0) {
118+
Write-Error "The verify tool found some problems."
119+
} else {
120+
Write-Output "The verify tool succeeded."
121+
}

eng/common/post-build/post-build-utils.ps1

-91
This file was deleted.

eng/common/post-build/publish-using-darc.ps1

+13-9
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,19 @@ param(
22
[Parameter(Mandatory=$true)][int] $BuildId,
33
[Parameter(Mandatory=$true)][int] $PublishingInfraVersion,
44
[Parameter(Mandatory=$true)][string] $AzdoToken,
5-
[Parameter(Mandatory=$true)][string] $MaestroToken,
65
[Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro.dot.net',
76
[Parameter(Mandatory=$true)][string] $WaitPublishingFinish,
87
[Parameter(Mandatory=$false)][string] $ArtifactsPublishingAdditionalParameters,
98
[Parameter(Mandatory=$false)][string] $SymbolPublishingAdditionalParameters
109
)
1110

1211
try {
13-
. $PSScriptRoot\post-build-utils.ps1
12+
# `tools.ps1` checks $ci to perform some actions. Since the post-build
13+
# scripts don't necessarily execute in the same agent that run the
14+
# build.ps1/sh script this variable isn't automatically set.
15+
$ci = $true
16+
$disableConfigureToolsetImport = $true
17+
. $PSScriptRoot\..\tools.ps1
1418

1519
$darc = Get-Darc
1620

@@ -31,13 +35,13 @@ try {
3135
}
3236

3337
& $darc add-build-to-channel `
34-
--id $buildId `
35-
--publishing-infra-version $PublishingInfraVersion `
36-
--default-channels `
37-
--source-branch main `
38-
--azdev-pat $AzdoToken `
39-
--bar-uri $MaestroApiEndPoint `
40-
--password $MaestroToken `
38+
--id $buildId `
39+
--publishing-infra-version $PublishingInfraVersion `
40+
--default-channels `
41+
--source-branch main `
42+
--azdev-pat "$AzdoToken" `
43+
--bar-uri "$MaestroApiEndPoint" `
44+
--ci `
4145
@optionalParams
4246

4347
if ($LastExitCode -ne 0) {

eng/common/post-build/sourcelink-validation.ps1

+9-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@ param(
66
[Parameter(Mandatory=$true)][string] $SourcelinkCliVersion # Version of SourceLink CLI to use
77
)
88

9-
. $PSScriptRoot\post-build-utils.ps1
9+
$ErrorActionPreference = 'Stop'
10+
Set-StrictMode -Version 2.0
11+
12+
# `tools.ps1` checks $ci to perform some actions. Since the post-build
13+
# scripts don't necessarily execute in the same agent that run the
14+
# build.ps1/sh script this variable isn't automatically set.
15+
$ci = $true
16+
$disableConfigureToolsetImport = $true
17+
. $PSScriptRoot\..\tools.ps1
1018

1119
# Cache/HashMap (File -> Exist flag) used to consult whether a file exist
1220
# in the repository at a specific commit point. This is populated by inserting

eng/common/post-build/symbols-validation.ps1

-2
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,6 @@ function InstallDotnetSymbol {
299299
}
300300

301301
try {
302-
. $PSScriptRoot\post-build-utils.ps1
303-
304302
InstallDotnetSymbol
305303

306304
foreach ($Job in @(Get-Job)) {

0 commit comments

Comments
 (0)