Skip to content

Commit 5cf1d7c

Browse files
authored
[automated] Merge branch 'release/10.0.1xx' => 'release/10.0.2xx' (#51239)
2 parents 547c258 + 1f2feef commit 5cf1d7c

File tree

9 files changed

+542
-506
lines changed

9 files changed

+542
-506
lines changed

eng/Version.Details.props

Lines changed: 130 additions & 130 deletions
Large diffs are not rendered by default.

eng/Version.Details.xml

Lines changed: 261 additions & 261 deletions
Large diffs are not rendered by default.

eng/common/SetupNugetSources.ps1

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# See example call for this script below.
88
#
99
# - task: PowerShell@2
10-
# displayName: Setup Private Feeds Credentials
10+
# displayName: Setup internal Feeds Credentials
1111
# condition: eq(variables['Agent.OS'], 'Windows_NT')
1212
# inputs:
1313
# filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.ps1
@@ -34,19 +34,28 @@ Set-StrictMode -Version 2.0
3434

3535
. $PSScriptRoot\tools.ps1
3636

37+
# Adds or enables the package source with the given name
38+
function AddOrEnablePackageSource($sources, $disabledPackageSources, $SourceName, $SourceEndPoint, $creds, $Username, $pwd) {
39+
if ($disabledPackageSources -eq $null -or -not (EnableInternalPackageSource -DisabledPackageSources $disabledPackageSources -Creds $creds -PackageSourceName $SourceName)) {
40+
AddPackageSource -Sources $sources -SourceName $SourceName -SourceEndPoint $SourceEndPoint -Creds $creds -Username $userName -pwd $Password
41+
}
42+
}
43+
3744
# Add source entry to PackageSources
3845
function AddPackageSource($sources, $SourceName, $SourceEndPoint, $creds, $Username, $pwd) {
3946
$packageSource = $sources.SelectSingleNode("add[@key='$SourceName']")
4047

4148
if ($packageSource -eq $null)
4249
{
50+
Write-Host "Adding package source $SourceName"
51+
4352
$packageSource = $doc.CreateElement("add")
4453
$packageSource.SetAttribute("key", $SourceName)
4554
$packageSource.SetAttribute("value", $SourceEndPoint)
4655
$sources.AppendChild($packageSource) | Out-Null
4756
}
4857
else {
49-
Write-Host "Package source $SourceName already present."
58+
Write-Host "Package source $SourceName already present and enabled."
5059
}
5160

5261
AddCredential -Creds $creds -Source $SourceName -Username $Username -pwd $pwd
@@ -59,6 +68,8 @@ function AddCredential($creds, $source, $username, $pwd) {
5968
return;
6069
}
6170

71+
Write-Host "Inserting credential for feed: " $source
72+
6273
# Looks for credential configuration for the given SourceName. Create it if none is found.
6374
$sourceElement = $creds.SelectSingleNode($Source)
6475
if ($sourceElement -eq $null)
@@ -91,24 +102,27 @@ function AddCredential($creds, $source, $username, $pwd) {
91102
$passwordElement.SetAttribute("value", $pwd)
92103
}
93104

94-
function InsertMaestroPrivateFeedCredentials($Sources, $Creds, $Username, $pwd) {
95-
$maestroPrivateSources = $Sources.SelectNodes("add[contains(@key,'darc-int')]")
96-
97-
Write-Host "Inserting credentials for $($maestroPrivateSources.Count) Maestro's private feeds."
98-
99-
ForEach ($PackageSource in $maestroPrivateSources) {
100-
Write-Host "`tInserting credential for Maestro's feed:" $PackageSource.Key
101-
AddCredential -Creds $creds -Source $PackageSource.Key -Username $Username -pwd $pwd
105+
# Enable all darc-int package sources.
106+
function EnableMaestroInternalPackageSources($DisabledPackageSources, $Creds) {
107+
$maestroInternalSources = $DisabledPackageSources.SelectNodes("add[contains(@key,'darc-int')]")
108+
ForEach ($DisabledPackageSource in $maestroInternalSources) {
109+
EnableInternalPackageSource -DisabledPackageSources $DisabledPackageSources -Creds $Creds -PackageSourceName $DisabledPackageSource.key
102110
}
103111
}
104112

105-
function EnablePrivatePackageSources($DisabledPackageSources) {
106-
$maestroPrivateSources = $DisabledPackageSources.SelectNodes("add[contains(@key,'darc-int')]")
107-
ForEach ($DisabledPackageSource in $maestroPrivateSources) {
108-
Write-Host "`tEnsuring private source '$($DisabledPackageSource.key)' is enabled by deleting it from disabledPackageSource"
113+
# Enables an internal package source by name, if found. Returns true if the package source was found and enabled, false otherwise.
114+
function EnableInternalPackageSource($DisabledPackageSources, $Creds, $PackageSourceName) {
115+
$DisabledPackageSource = $DisabledPackageSources.SelectSingleNode("add[@key='$PackageSourceName']")
116+
if ($DisabledPackageSource) {
117+
Write-Host "Enabling internal source '$($DisabledPackageSource.key)'."
118+
109119
# Due to https://github.com/NuGet/Home/issues/10291, we must actually remove the disabled entries
110120
$DisabledPackageSources.RemoveChild($DisabledPackageSource)
121+
122+
AddCredential -Creds $creds -Source $DisabledPackageSource.Key -Username $userName -pwd $Password
123+
return $true
111124
}
125+
return $false
112126
}
113127

114128
if (!(Test-Path $ConfigFile -PathType Leaf)) {
@@ -121,15 +135,17 @@ $doc = New-Object System.Xml.XmlDocument
121135
$filename = (Get-Item $ConfigFile).FullName
122136
$doc.Load($filename)
123137

124-
# Get reference to <PackageSources> or create one if none exist already
138+
# Get reference to <PackageSources> - fail if none exist
125139
$sources = $doc.DocumentElement.SelectSingleNode("packageSources")
126140
if ($sources -eq $null) {
127-
$sources = $doc.CreateElement("packageSources")
128-
$doc.DocumentElement.AppendChild($sources) | Out-Null
141+
Write-PipelineTelemetryError -Category 'Build' -Message "Eng/common/SetupNugetSources.ps1 returned a non-zero exit code. NuGet config file must contain a packageSources section: $ConfigFile"
142+
ExitWithExitCode 1
129143
}
130144

131145
$creds = $null
146+
$feedSuffix = "v3/index.json"
132147
if ($Password) {
148+
$feedSuffix = "v2"
133149
# Looks for a <PackageSourceCredentials> node. Create it if none is found.
134150
$creds = $doc.DocumentElement.SelectSingleNode("packageSourceCredentials")
135151
if ($creds -eq $null) {
@@ -138,33 +154,22 @@ if ($Password) {
138154
}
139155
}
140156

157+
$userName = "dn-bot"
158+
141159
# Check for disabledPackageSources; we'll enable any darc-int ones we find there
142160
$disabledSources = $doc.DocumentElement.SelectSingleNode("disabledPackageSources")
143161
if ($disabledSources -ne $null) {
144162
Write-Host "Checking for any darc-int disabled package sources in the disabledPackageSources node"
145-
EnablePrivatePackageSources -DisabledPackageSources $disabledSources
146-
}
147-
148-
$userName = "dn-bot"
149-
150-
# Insert credential nodes for Maestro's private feeds
151-
InsertMaestroPrivateFeedCredentials -Sources $sources -Creds $creds -Username $userName -pwd $Password
152-
153-
# 3.1 uses a different feed url format so it's handled differently here
154-
$dotnet31Source = $sources.SelectSingleNode("add[@key='dotnet3.1']")
155-
if ($dotnet31Source -ne $null) {
156-
AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v2" -Creds $creds -Username $userName -pwd $Password
157-
AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v2" -Creds $creds -Username $userName -pwd $Password
163+
EnableMaestroInternalPackageSources -DisabledPackageSources $disabledSources -Creds $creds
158164
}
159-
160165
$dotnetVersions = @('5','6','7','8','9','10')
161166

162167
foreach ($dotnetVersion in $dotnetVersions) {
163168
$feedPrefix = "dotnet" + $dotnetVersion;
164169
$dotnetSource = $sources.SelectSingleNode("add[@key='$feedPrefix']")
165170
if ($dotnetSource -ne $null) {
166-
AddPackageSource -Sources $sources -SourceName "$feedPrefix-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/$feedPrefix-internal/nuget/v2" -Creds $creds -Username $userName -pwd $Password
167-
AddPackageSource -Sources $sources -SourceName "$feedPrefix-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/$feedPrefix-internal-transport/nuget/v2" -Creds $creds -Username $userName -pwd $Password
171+
AddOrEnablePackageSource -Sources $sources -DisabledPackageSources $disabledSources -SourceName "$feedPrefix-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/$feedPrefix-internal/nuget/$feedSuffix" -Creds $creds -Username $userName -pwd $Password
172+
AddOrEnablePackageSource -Sources $sources -DisabledPackageSources $disabledSources -SourceName "$feedPrefix-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/$feedPrefix-internal-transport/nuget/$feedSuffix" -Creds $creds -Username $userName -pwd $Password
168173
}
169174
}
170175

eng/common/SetupNugetSources.sh

Lines changed: 103 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -52,78 +52,126 @@ if [[ `uname -s` == "Darwin" ]]; then
5252
TB=''
5353
fi
5454

55-
# Ensure there is a <packageSources>...</packageSources> section.
56-
grep -i "<packageSources>" $ConfigFile
57-
if [ "$?" != "0" ]; then
58-
echo "Adding <packageSources>...</packageSources> section."
59-
ConfigNodeHeader="<configuration>"
60-
PackageSourcesTemplate="${TB}<packageSources>${NL}${TB}</packageSources>"
55+
# Enables an internal package source by name, if found. Returns 0 if found and enabled, 1 if not found.
56+
EnableInternalPackageSource() {
57+
local PackageSourceName="$1"
58+
59+
# Check if disabledPackageSources section exists
60+
grep -i "<disabledPackageSources>" "$ConfigFile" > /dev/null
61+
if [ "$?" != "0" ]; then
62+
return 1 # No disabled sources section
63+
fi
64+
65+
# Check if this source name is disabled
66+
grep -i "<add key=\"$PackageSourceName\" value=\"true\"" "$ConfigFile" > /dev/null
67+
if [ "$?" == "0" ]; then
68+
echo "Enabling internal source '$PackageSourceName'."
69+
# Remove the disabled entry
70+
local OldDisableValue="<add key=\"$PackageSourceName\" value=\"true\" />"
71+
local NewDisableValue="<!-- Reenabled for build : $PackageSourceName -->"
72+
sed -i.bak "s|$OldDisableValue|$NewDisableValue|" "$ConfigFile"
73+
74+
# Add the source name to PackageSources for credential handling
75+
PackageSources+=("$PackageSourceName")
76+
return 0 # Found and enabled
77+
fi
78+
79+
return 1 # Not found in disabled sources
80+
}
81+
82+
# Add source entry to PackageSources
83+
AddPackageSource() {
84+
local SourceName="$1"
85+
local SourceEndPoint="$2"
86+
87+
# Check if source already exists
88+
grep -i "<add key=\"$SourceName\"" "$ConfigFile" > /dev/null
89+
if [ "$?" == "0" ]; then
90+
echo "Package source $SourceName already present and enabled."
91+
PackageSources+=("$SourceName")
92+
return
93+
fi
94+
95+
echo "Adding package source $SourceName"
96+
PackageSourcesNodeFooter="</packageSources>"
97+
PackageSourceTemplate="${TB}<add key=\"$SourceName\" value=\"$SourceEndPoint\" />"
98+
99+
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" "$ConfigFile"
100+
PackageSources+=("$SourceName")
101+
}
102+
103+
# Adds or enables the package source with the given name
104+
AddOrEnablePackageSource() {
105+
local SourceName="$1"
106+
local SourceEndPoint="$2"
107+
108+
# Try to enable if disabled, if not found then add new source
109+
EnableInternalPackageSource "$SourceName"
110+
if [ "$?" != "0" ]; then
111+
AddPackageSource "$SourceName" "$SourceEndPoint"
112+
fi
113+
}
61114

62-
sed -i.bak "s|$ConfigNodeHeader|$ConfigNodeHeader${NL}$PackageSourcesTemplate|" $ConfigFile
63-
fi
115+
# Enable all darc-int package sources
116+
EnableMaestroInternalPackageSources() {
117+
# Check if disabledPackageSources section exists
118+
grep -i "<disabledPackageSources>" "$ConfigFile" > /dev/null
119+
if [ "$?" != "0" ]; then
120+
return # No disabled sources section
121+
fi
122+
123+
# Find all darc-int disabled sources
124+
local DisabledDarcIntSources=()
125+
DisabledDarcIntSources+=$(grep -oh '"darc-int-[^"]*" value="true"' "$ConfigFile" | tr -d '"')
126+
127+
for DisabledSourceName in ${DisabledDarcIntSources[@]} ; do
128+
if [[ $DisabledSourceName == darc-int* ]]; then
129+
EnableInternalPackageSource "$DisabledSourceName"
130+
fi
131+
done
132+
}
64133

65-
# Ensure there is a <packageSourceCredentials>...</packageSourceCredentials> section.
66-
grep -i "<packageSourceCredentials>" $ConfigFile
134+
# Ensure there is a <packageSources>...</packageSources> section.
135+
grep -i "<packageSources>" $ConfigFile
67136
if [ "$?" != "0" ]; then
68-
echo "Adding <packageSourceCredentials>...</packageSourceCredentials> section."
69-
70-
PackageSourcesNodeFooter="</packageSources>"
71-
PackageSourceCredentialsTemplate="${TB}<packageSourceCredentials>${NL}${TB}</packageSourceCredentials>"
72-
73-
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourcesNodeFooter${NL}$PackageSourceCredentialsTemplate|" $ConfigFile
137+
Write-PipelineTelemetryError -Category 'Build' "Error: Eng/common/SetupNugetSources.sh returned a non-zero exit code. NuGet config file must contain a packageSources section: $ConfigFile"
138+
ExitWithExitCode 1
74139
fi
75140

76141
PackageSources=()
77142

78-
# Ensure dotnet3.1-internal and dotnet3.1-internal-transport are in the packageSources if the public dotnet3.1 feeds are present
79-
grep -i "<add key=\"dotnet3.1\"" $ConfigFile
80-
if [ "$?" == "0" ]; then
81-
grep -i "<add key=\"dotnet3.1-internal\"" $ConfigFile
143+
# Set feed suffix based on whether credentials are provided
144+
FeedSuffix="v3/index.json"
145+
if [ -n "$CredToken" ]; then
146+
FeedSuffix="v2"
147+
148+
# Ensure there is a <packageSourceCredentials>...</packageSourceCredentials> section.
149+
grep -i "<packageSourceCredentials>" $ConfigFile
82150
if [ "$?" != "0" ]; then
83-
echo "Adding dotnet3.1-internal to the packageSources."
84-
PackageSourcesNodeFooter="</packageSources>"
85-
PackageSourceTemplate="${TB}<add key=\"dotnet3.1-internal\" value=\"https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v2\" />"
151+
echo "Adding <packageSourceCredentials>...</packageSourceCredentials> section."
86152

87-
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile
88-
fi
89-
PackageSources+=('dotnet3.1-internal')
90-
91-
grep -i "<add key=\"dotnet3.1-internal-transport\">" $ConfigFile
92-
if [ "$?" != "0" ]; then
93-
echo "Adding dotnet3.1-internal-transport to the packageSources."
94153
PackageSourcesNodeFooter="</packageSources>"
95-
PackageSourceTemplate="${TB}<add key=\"dotnet3.1-internal-transport\" value=\"https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v2\" />"
154+
PackageSourceCredentialsTemplate="${TB}<packageSourceCredentials>${NL}${TB}</packageSourceCredentials>"
96155

97-
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile
156+
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourcesNodeFooter${NL}$PackageSourceCredentialsTemplate|" $ConfigFile
98157
fi
99-
PackageSources+=('dotnet3.1-internal-transport')
158+
fi
159+
160+
# Check for disabledPackageSources; we'll enable any darc-int ones we find there
161+
grep -i "<disabledPackageSources>" $ConfigFile > /dev/null
162+
if [ "$?" == "0" ]; then
163+
echo "Checking for any darc-int disabled package sources in the disabledPackageSources node"
164+
EnableMaestroInternalPackageSources
100165
fi
101166

102167
DotNetVersions=('5' '6' '7' '8' '9' '10')
103168

104169
for DotNetVersion in ${DotNetVersions[@]} ; do
105170
FeedPrefix="dotnet${DotNetVersion}";
106-
grep -i "<add key=\"$FeedPrefix\"" $ConfigFile
171+
grep -i "<add key=\"$FeedPrefix\"" $ConfigFile > /dev/null
107172
if [ "$?" == "0" ]; then
108-
grep -i "<add key=\"$FeedPrefix-internal\"" $ConfigFile
109-
if [ "$?" != "0" ]; then
110-
echo "Adding $FeedPrefix-internal to the packageSources."
111-
PackageSourcesNodeFooter="</packageSources>"
112-
PackageSourceTemplate="${TB}<add key=\"$FeedPrefix-internal\" value=\"https://pkgs.dev.azure.com/dnceng/internal/_packaging/$FeedPrefix-internal/nuget/v2\" />"
113-
114-
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile
115-
fi
116-
PackageSources+=("$FeedPrefix-internal")
117-
118-
grep -i "<add key=\"$FeedPrefix-internal-transport\">" $ConfigFile
119-
if [ "$?" != "0" ]; then
120-
echo "Adding $FeedPrefix-internal-transport to the packageSources."
121-
PackageSourcesNodeFooter="</packageSources>"
122-
PackageSourceTemplate="${TB}<add key=\"$FeedPrefix-internal-transport\" value=\"https://pkgs.dev.azure.com/dnceng/internal/_packaging/$FeedPrefix-internal-transport/nuget/v2\" />"
123-
124-
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile
125-
fi
126-
PackageSources+=("$FeedPrefix-internal-transport")
173+
AddOrEnablePackageSource "$FeedPrefix-internal" "https://pkgs.dev.azure.com/dnceng/internal/_packaging/$FeedPrefix-internal/nuget/$FeedSuffix"
174+
AddOrEnablePackageSource "$FeedPrefix-internal-transport" "https://pkgs.dev.azure.com/dnceng/internal/_packaging/$FeedPrefix-internal-transport/nuget/$FeedSuffix"
127175
fi
128176
done
129177

@@ -139,29 +187,12 @@ if [ "$CredToken" ]; then
139187
# Check if there is no existing credential for this FeedName
140188
grep -i "<$FeedName>" $ConfigFile
141189
if [ "$?" != "0" ]; then
142-
echo "Adding credentials for $FeedName."
190+
echo " Inserting credential for feed: $FeedName"
143191

144192
PackageSourceCredentialsNodeFooter="</packageSourceCredentials>"
145-
NewCredential="${TB}${TB}<$FeedName>${NL}<add key=\"Username\" value=\"dn-bot\" />${NL}<add key=\"ClearTextPassword\" value=\"$CredToken\" />${NL}</$FeedName>"
193+
NewCredential="${TB}${TB}<$FeedName>${NL}${TB}<add key=\"Username\" value=\"dn-bot\" />${NL}${TB}${TB}<add key=\"ClearTextPassword\" value=\"$CredToken\" />${NL}${TB}${TB}</$FeedName>"
146194

147195
sed -i.bak "s|$PackageSourceCredentialsNodeFooter|$NewCredential${NL}$PackageSourceCredentialsNodeFooter|" $ConfigFile
148196
fi
149197
done
150198
fi
151-
152-
# Re-enable any entries in disabledPackageSources where the feed name contains darc-int
153-
grep -i "<disabledPackageSources>" $ConfigFile
154-
if [ "$?" == "0" ]; then
155-
DisabledDarcIntSources=()
156-
echo "Re-enabling any disabled \"darc-int\" package sources in $ConfigFile"
157-
DisabledDarcIntSources+=$(grep -oh '"darc-int-[^"]*" value="true"' $ConfigFile | tr -d '"')
158-
for DisabledSourceName in ${DisabledDarcIntSources[@]} ; do
159-
if [[ $DisabledSourceName == darc-int* ]]
160-
then
161-
OldDisableValue="<add key=\"$DisabledSourceName\" value=\"true\" />"
162-
NewDisableValue="<!-- Reenabled for build : $DisabledSourceName -->"
163-
sed -i.bak "s|$OldDisableValue|$NewDisableValue|" $ConfigFile
164-
echo "Neutralized disablePackageSources entry for '$DisabledSourceName'"
165-
fi
166-
done
167-
fi

global.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
}
2222
},
2323
"msbuild-sdks": {
24-
"Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25510.102",
25-
"Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.25510.102",
24+
"Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25513.102",
25+
"Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.25513.102",
2626
"Microsoft.Build.NoTargets": "3.7.0",
2727
"Microsoft.Build.Traversal": "3.4.0",
2828
"Microsoft.WixToolset.Sdk": "5.0.2-dotnet.2737382"

template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/MSTest-CSharp/Company.TestProject1.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--#if (UseMSTestSdk)-->
2-
<Project Sdk="MSTest.Sdk/4.0.0">
2+
<Project Sdk="MSTest.Sdk/4.0.1">
33

44
<PropertyGroup>
55
<TargetFramework Condition="'$(TargetFrameworkOverride)' == ''">net10.0</TargetFramework>
@@ -43,7 +43,7 @@
4343
<!--#if (CoverageTool == "coverlet")-->
4444
<PackageReference Include="coverlet.collector" Version="6.0.4" />
4545
<!--#endif-->
46-
<PackageReference Include="MSTest" Version="4.0.0" />
46+
<PackageReference Include="MSTest" Version="4.0.1" />
4747
</ItemGroup>
4848

4949
<ItemGroup>

0 commit comments

Comments
 (0)