Skip to content

Commit 0eb881c

Browse files
authored
Upgrade dotnet/arcade to fix the deprecated feed issue. (#807)
1 parent 638898d commit 0eb881c

10 files changed

+175
-95
lines changed

NuGet.config

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@
77
<add key="dotnet-tools" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
88
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
99
<add key="dotnet5" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json" />
10-
<add key="dotnet-try" value="https://dotnet.myget.org/F/dotnet-try/api/v3/index.json" />
1110
</packageSources>
1211
</configuration>

eng/common/SetupNugetSources.ps1

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
# See example YAML call for this script below. Note the use of the variable `$(dn-bot-dnceng-artifact-feeds-rw)`
1212
# from the AzureDevOps-Artifact-Feeds-Pats variable group.
1313
#
14+
# Any disabledPackageSources entries which start with "darc-int" will be re-enabled as part of this script executing
15+
#
1416
# - task: PowerShell@2
1517
# displayName: Setup Private Feeds Credentials
1618
# condition: eq(variables['Agent.OS'], 'Windows_NT')
@@ -94,6 +96,15 @@ function InsertMaestroPrivateFeedCredentials($Sources, $Creds, $Username, $Passw
9496
}
9597
}
9698

99+
function EnablePrivatePackageSources($DisabledPackageSources) {
100+
$maestroPrivateSources = $DisabledPackageSources.SelectNodes("add[contains(@key,'darc-int')]")
101+
ForEach ($DisabledPackageSource in $maestroPrivateSources) {
102+
Write-Host "`tEnsuring private source '$($DisabledPackageSource.key)' is enabled by deleting it from disabledPackageSource"
103+
# Due to https://github.com/NuGet/Home/issues/10291, we must actually remove the disabled entries
104+
$DisabledPackageSources.RemoveChild($DisabledPackageSource)
105+
}
106+
}
107+
97108
if (!(Test-Path $ConfigFile -PathType Leaf)) {
98109
Write-PipelineTelemetryError -Category 'Build' -Message "Eng/common/SetupNugetSources.ps1 returned a non-zero exit code. Couldn't find the NuGet config file: $ConfigFile"
99110
ExitWithExitCode 1
@@ -123,6 +134,13 @@ if ($creds -eq $null) {
123134
$doc.DocumentElement.AppendChild($creds) | Out-Null
124135
}
125136

137+
# Check for disabledPackageSources; we'll enable any darc-int ones we find there
138+
$disabledSources = $doc.DocumentElement.SelectSingleNode("disabledPackageSources")
139+
if ($disabledSources -ne $null) {
140+
Write-Host "Checking for any darc-int disabled package sources in the disabledPackageSources node"
141+
EnablePrivatePackageSources -DisabledPackageSources $disabledSources
142+
}
143+
126144
$userName = "dn-bot"
127145

128146
# Insert credential nodes for Maestro's private feeds

eng/common/SetupNugetSources.sh

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
# See example YAML call for this script below. Note the use of the variable `$(dn-bot-dnceng-artifact-feeds-rw)`
1414
# from the AzureDevOps-Artifact-Feeds-Pats variable group.
1515
#
16+
# Any disabledPackageSources entries which start with "darc-int" will be re-enabled as part of this script executing.
17+
#
1618
# - task: Bash@3
1719
# displayName: Setup Private Feeds Credentials
1820
# inputs:
@@ -63,7 +65,7 @@ if [ "$?" != "0" ]; then
6365
ConfigNodeHeader="<configuration>"
6466
PackageSourcesTemplate="${TB}<packageSources>${NL}${TB}</packageSources>"
6567

66-
sed -i.bak "s|$ConfigNodeHeader|$ConfigNodeHeader${NL}$PackageSourcesTemplate|" NuGet.config
68+
sed -i.bak "s|$ConfigNodeHeader|$ConfigNodeHeader${NL}$PackageSourcesTemplate|" $ConfigFile
6769
fi
6870

6971
# Ensure there is a <packageSourceCredentials>...</packageSourceCredentials> section.
@@ -74,7 +76,7 @@ if [ "$?" != "0" ]; then
7476
PackageSourcesNodeFooter="</packageSources>"
7577
PackageSourceCredentialsTemplate="${TB}<packageSourceCredentials>${NL}${TB}</packageSourceCredentials>"
7678

77-
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourcesNodeFooter${NL}$PackageSourceCredentialsTemplate|" NuGet.config
79+
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourcesNodeFooter${NL}$PackageSourceCredentialsTemplate|" $ConfigFile
7880
fi
7981

8082
PackageSources=()
@@ -146,4 +148,21 @@ for FeedName in ${PackageSources[@]} ; do
146148

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

eng/common/darc-init.ps1

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
param (
22
$darcVersion = $null,
3-
$versionEndpoint = "https://maestro-prod.westus2.cloudapp.azure.com/api/assets/darc-version?api-version=2019-01-16",
4-
$verbosity = "m"
3+
$versionEndpoint = 'https://maestro-prod.westus2.cloudapp.azure.com/api/assets/darc-version?api-version=2019-01-16',
4+
$verbosity = 'minimal',
5+
$toolpath = $null
56
)
67

78
. $PSScriptRoot\tools.ps1
89

9-
function InstallDarcCli ($darcVersion) {
10-
$darcCliPackageName = "microsoft.dotnet.darc"
10+
function InstallDarcCli ($darcVersion, $toolpath) {
11+
$darcCliPackageName = 'microsoft.dotnet.darc'
1112

1213
$dotnetRoot = InitializeDotNetCli -install:$true
1314
$dotnet = "$dotnetRoot\dotnet.exe"
@@ -23,11 +24,24 @@ function InstallDarcCli ($darcVersion) {
2324
$darcVersion = $(Invoke-WebRequest -Uri $versionEndpoint -UseBasicParsing).Content
2425
}
2526

26-
$arcadeServicesSource = 'https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json'
27+
$arcadeServicesSource = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
2728

2829
Write-Host "Installing Darc CLI version $darcVersion..."
29-
Write-Host "You may need to restart your command window if this is the first dotnet tool you have installed."
30-
& "$dotnet" tool install $darcCliPackageName --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity -g --framework netcoreapp2.1
30+
Write-Host 'You may need to restart your command window if this is the first dotnet tool you have installed.'
31+
if (-not $toolpath) {
32+
Write-Host "'$dotnet' tool install $darcCliPackageName --version $darcVersion --add-source '$arcadeServicesSource' -v $verbosity -g"
33+
& "$dotnet" tool install $darcCliPackageName --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity -g
34+
}else {
35+
Write-Host "'$dotnet' tool install $darcCliPackageName --version $darcVersion --add-source '$arcadeServicesSource' -v $verbosity --tool-path '$toolpath'"
36+
& "$dotnet" tool install $darcCliPackageName --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity --tool-path "$toolpath"
37+
}
3138
}
3239

33-
InstallDarcCli $darcVersion
40+
try {
41+
InstallDarcCli $darcVersion $toolpath
42+
}
43+
catch {
44+
Write-Host $_.ScriptStackTrace
45+
Write-PipelineTelemetryError -Category 'Darc' -Message $_
46+
ExitWithExitCode 1
47+
}

eng/common/darc-init.sh

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
source="${BASH_SOURCE[0]}"
44
darcVersion=''
5-
versionEndpoint="https://maestro-prod.westus2.cloudapp.azure.com/api/assets/darc-version?api-version=2019-01-16"
6-
verbosity=m
5+
versionEndpoint='https://maestro-prod.westus2.cloudapp.azure.com/api/assets/darc-version?api-version=2019-01-16'
6+
verbosity='minimal'
77

88
while [[ $# > 0 ]]; do
99
opt="$(echo "$1" | awk '{print tolower($0)}')"
@@ -20,6 +20,10 @@ while [[ $# > 0 ]]; do
2020
verbosity=$2
2121
shift
2222
;;
23+
--toolpath)
24+
toolpath=$2
25+
shift
26+
;;
2327
*)
2428
echo "Invalid argument: $1"
2529
usage
@@ -52,17 +56,27 @@ function InstallDarcCli {
5256
InitializeDotNetCli
5357
local dotnet_root=$_InitializeDotNetCli
5458

55-
local uninstall_command=`$dotnet_root/dotnet tool uninstall $darc_cli_package_name -g`
56-
local tool_list=$($dotnet_root/dotnet tool list -g)
57-
if [[ $tool_list = *$darc_cli_package_name* ]]; then
58-
echo $($dotnet_root/dotnet tool uninstall $darc_cli_package_name -g)
59+
if [ -z "$toolpath" ]; then
60+
local tool_list=$($dotnet_root/dotnet tool list -g)
61+
if [[ $tool_list = *$darc_cli_package_name* ]]; then
62+
echo $($dotnet_root/dotnet tool uninstall $darc_cli_package_name -g)
63+
fi
64+
else
65+
local tool_list=$($dotnet_root/dotnet tool list --tool-path "$toolpath")
66+
if [[ $tool_list = *$darc_cli_package_name* ]]; then
67+
echo $($dotnet_root/dotnet tool uninstall $darc_cli_package_name --tool-path "$toolpath")
68+
fi
5969
fi
6070

61-
local arcadeServicesSource="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json"
71+
local arcadeServicesSource="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json"
6272

6373
echo "Installing Darc CLI version $darcVersion..."
6474
echo "You may need to restart your command shell if this is the first dotnet tool you have installed."
65-
echo $($dotnet_root/dotnet tool install $darc_cli_package_name --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity -g)
75+
if [ -z "$toolpath" ]; then
76+
echo $($dotnet_root/dotnet tool install $darc_cli_package_name --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity -g)
77+
else
78+
echo $($dotnet_root/dotnet tool install $darc_cli_package_name --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity --tool-path "$toolpath")
79+
fi
6680
}
6781

6882
InstallDarcCli

eng/common/sdl/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Microsoft.Guardian.Cli" version="0.7.2"/>
3+
<package id="Microsoft.Guardian.Cli.win10-x64" version="0.20.1"/>
44
</packages>

eng/common/templates/job/execute-sdl.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
continueOnError: ${{ parameters.sdlContinueOnError }}
6666
- ${{ if eq(parameters.overrideParameters, '') }}:
6767
- powershell: eng/common/sdl/execute-all-sdl-tools.ps1
68-
-GuardianPackageName Microsoft.Guardian.Cli.0.7.2
68+
-GuardianPackageName Microsoft.Guardian.Cli.win10-x64.0.20.1
6969
-NugetPackageDirectory $(Build.SourcesDirectory)\.packages
7070
-AzureDevOpsAccessToken $(dn-bot-dotnet-build-rw-code-rw)
7171
${{ parameters.additionalParameters }}

eng/common/templates/post-build/common-variables.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,6 @@ variables:
2929
- name: NetCore_3_Tools_Channel_Id
3030
value: 344
3131

32-
# .NET Core 3.0 Internal Servicing
33-
- name: InternalServicing_30_Channel_Id
34-
value: 184
35-
36-
# .NET Core 3.0 Release
37-
- name: PublicRelease_30_Channel_Id
38-
value: 19
39-
4032
# .NET Core 3.1 Release
4133
- name: PublicRelease_31_Channel_Id
4234
value: 129

0 commit comments

Comments
 (0)