Skip to content

Commit 32d8e9a

Browse files
[release/dev16.4] Update dependencies from dotnet/arcade (#7937)
* Update dependencies from https://github.com/dotnet/arcade build 20191203.16 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19603.16 * rationalize package icon inclusion
1 parent e7597de commit 32d8e9a

26 files changed

+762
-861
lines changed

eng/Version.Details.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
<ProductDependencies>
44
</ProductDependencies>
55
<ToolsetDependencies>
6-
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="5.0.0-beta.19476.6">
6+
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.19603.16">
77
<Uri>https://github.com/dotnet/arcade</Uri>
8-
<Sha>b449f372df1a3374ebdc85f42ff137dcda08776b</Sha>
8+
<Sha>8e47254f93b276c974968aff83222f89ec3931ed</Sha>
99
</Dependency>
1010
</ToolsetDependencies>
1111
</Dependencies>

eng/common/SetupNugetSources.ps1

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# This file is a temporary workaround for internal builds to be able to restore from private AzDO feeds.
2+
# This file should be removed as part of this issue: https://github.com/dotnet/arcade/issues/4080
3+
#
4+
# What the script does is iterate over all package sources in the pointed NuGet.config and add a credential entry
5+
# under <packageSourceCredentials> for each Maestro managed private feed. Two additional credential
6+
# entries are also added for the two private static internal feeds: dotnet3-internal and dotnet3-internal-transport.
7+
#
8+
# This script needs to be called in every job that will restore packages and which the base repo has
9+
# private AzDO feeds in the NuGet.config.
10+
#
11+
# See example YAML call for this script below. Note the use of the variable `$(dn-bot-dnceng-artifact-feeds-rw)`
12+
# from the AzureDevOps-Artifact-Feeds-Pats variable group.
13+
#
14+
# - task: PowerShell@2
15+
# displayName: Setup Private Feeds Credentials
16+
# condition: eq(variables['Agent.OS'], 'Windows_NT')
17+
# inputs:
18+
# filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1
19+
# arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $Env:Token
20+
# env:
21+
# Token: $(dn-bot-dnceng-artifact-feeds-rw)
22+
23+
[CmdletBinding()]
24+
param (
25+
[Parameter(Mandatory = $true)][string]$ConfigFile,
26+
[Parameter(Mandatory = $true)][string]$Password
27+
)
28+
29+
$ErrorActionPreference = "Stop"
30+
Set-StrictMode -Version 2.0
31+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
32+
33+
. $PSScriptRoot\tools.ps1
34+
35+
# Add source entry to PackageSources
36+
function AddPackageSource($sources, $SourceName, $SourceEndPoint, $creds, $Username, $Password) {
37+
$packageSource = $sources.SelectSingleNode("add[@key='$SourceName']")
38+
39+
if ($packageSource -eq $null)
40+
{
41+
$packageSource = $doc.CreateElement("add")
42+
$packageSource.SetAttribute("key", $SourceName)
43+
$packageSource.SetAttribute("value", $SourceEndPoint)
44+
$sources.AppendChild($packageSource) | Out-Null
45+
}
46+
else {
47+
Write-Host "Package source $SourceName already present."
48+
}
49+
50+
AddCredential -Creds $creds -Source $SourceName -Username $Username -Password $Password
51+
}
52+
53+
# Add a credential node for the specified source
54+
function AddCredential($creds, $source, $username, $password) {
55+
# Looks for credential configuration for the given SourceName. Create it if none is found.
56+
$sourceElement = $creds.SelectSingleNode($Source)
57+
if ($sourceElement -eq $null)
58+
{
59+
$sourceElement = $doc.CreateElement($Source)
60+
$creds.AppendChild($sourceElement) | Out-Null
61+
}
62+
63+
# Add the <Username> node to the credential if none is found.
64+
$usernameElement = $sourceElement.SelectSingleNode("add[@key='Username']")
65+
if ($usernameElement -eq $null)
66+
{
67+
$usernameElement = $doc.CreateElement("add")
68+
$usernameElement.SetAttribute("key", "Username")
69+
$sourceElement.AppendChild($usernameElement) | Out-Null
70+
}
71+
$usernameElement.SetAttribute("value", $Username)
72+
73+
# Add the <ClearTextPassword> to the credential if none is found.
74+
# Add it as a clear text because there is no support for encrypted ones in non-windows .Net SDKs.
75+
# -> https://github.com/NuGet/Home/issues/5526
76+
$passwordElement = $sourceElement.SelectSingleNode("add[@key='ClearTextPassword']")
77+
if ($passwordElement -eq $null)
78+
{
79+
$passwordElement = $doc.CreateElement("add")
80+
$passwordElement.SetAttribute("key", "ClearTextPassword")
81+
$sourceElement.AppendChild($passwordElement) | Out-Null
82+
}
83+
$passwordElement.SetAttribute("value", $Password)
84+
}
85+
86+
function InsertMaestroPrivateFeedCredentials($Sources, $Creds, $Password) {
87+
$maestroPrivateSources = $Sources.SelectNodes("add[contains(@key,'darc-int')]")
88+
89+
Write-Host "Inserting credentials for $($maestroPrivateSources.Count) Maestro's private feeds."
90+
91+
ForEach ($PackageSource in $maestroPrivateSources) {
92+
Write-Host "`tInserting credential for Maestro's feed:" $PackageSource.Key
93+
AddCredential -Creds $creds -Source $PackageSource.Key -Username $Username -Password $Password
94+
}
95+
}
96+
97+
if (!(Test-Path $ConfigFile -PathType Leaf)) {
98+
Write-PipelineTelemetryError -Category 'Build' -Message "Eng/common/SetupNugetSources.ps1 returned a non-zero exit code. Couldn't find the NuGet config file: $ConfigFile"
99+
ExitWithExitCode 1
100+
}
101+
102+
if (!$Password) {
103+
Write-PipelineTelemetryError -Category 'Build' -Message 'Eng/common/SetupNugetSources.ps1 returned a non-zero exit code. Please supply a valid PAT'
104+
ExitWithExitCode 1
105+
}
106+
107+
# Load NuGet.config
108+
$doc = New-Object System.Xml.XmlDocument
109+
$filename = (Get-Item $ConfigFile).FullName
110+
$doc.Load($filename)
111+
112+
# Get reference to <PackageSources> or create one if none exist already
113+
$sources = $doc.DocumentElement.SelectSingleNode("packageSources")
114+
if ($sources -eq $null) {
115+
$sources = $doc.CreateElement("packageSources")
116+
$doc.DocumentElement.AppendChild($sources) | Out-Null
117+
}
118+
119+
# Looks for a <PackageSourceCredentials> node. Create it if none is found.
120+
$creds = $doc.DocumentElement.SelectSingleNode("packageSourceCredentials")
121+
if ($creds -eq $null) {
122+
$creds = $doc.CreateElement("packageSourceCredentials")
123+
$doc.DocumentElement.AppendChild($creds) | Out-Null
124+
}
125+
126+
# Insert credential nodes for Maestro's private feeds
127+
InsertMaestroPrivateFeedCredentials -Sources $sources -Creds $creds -Password $Password
128+
129+
$dotnet3Source = $sources.SelectSingleNode("add[@key='dotnet3']")
130+
if ($dotnet3Source -ne $null) {
131+
AddPackageSource -Sources $sources -SourceName "dotnet3-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal/nuget/v2" -Creds $creds -Username "dn-bot" -Password $Password
132+
AddPackageSource -Sources $sources -SourceName "dotnet3-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal-transport/nuget/v2" -Creds $creds -Username "dn-bot" -Password $Password
133+
}
134+
135+
$dotnet31Source = $sources.SelectSingleNode("add[@key='dotnet3.1']")
136+
if ($dotnet31Source -ne $null) {
137+
AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v2" -Creds $creds -Username "dn-bot" -Password $Password
138+
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 "dn-bot" -Password $Password
139+
}
140+
141+
$doc.Save($filename)

eng/common/SetupNugetSources.sh

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
#!/usr/bin/env bash
2+
3+
# This file is a temporary workaround for internal builds to be able to restore from private AzDO feeds.
4+
# This file should be removed as part of this issue: https://github.com/dotnet/arcade/issues/4080
5+
#
6+
# What the script does is iterate over all package sources in the pointed NuGet.config and add a credential entry
7+
# under <packageSourceCredentials> for each Maestro's managed private feed. Two additional credential
8+
# entries are also added for the two private static internal feeds: dotnet3-internal and dotnet3-internal-transport.
9+
#
10+
# This script needs to be called in every job that will restore packages and which the base repo has
11+
# private AzDO feeds in the NuGet.config.
12+
#
13+
# See example YAML call for this script below. Note the use of the variable `$(dn-bot-dnceng-artifact-feeds-rw)`
14+
# from the AzureDevOps-Artifact-Feeds-Pats variable group.
15+
#
16+
# - task: Bash@3
17+
# displayName: Setup Private Feeds Credentials
18+
# inputs:
19+
# filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh
20+
# arguments: $(Build.SourcesDirectory)/NuGet.config $Token
21+
# condition: ne(variables['Agent.OS'], 'Windows_NT')
22+
# env:
23+
# Token: $(dn-bot-dnceng-artifact-feeds-rw)
24+
25+
ConfigFile=$1
26+
CredToken=$2
27+
NL='\n'
28+
TB=' '
29+
30+
source="${BASH_SOURCE[0]}"
31+
32+
# resolve $source until the file is no longer a symlink
33+
while [[ -h "$source" ]]; do
34+
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
35+
source="$(readlink "$source")"
36+
# if $source was a relative symlink, we need to resolve it relative to the path where the
37+
# symlink file was located
38+
[[ $source != /* ]] && source="$scriptroot/$source"
39+
done
40+
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
41+
42+
. "$scriptroot/tools.sh"
43+
44+
if [ ! -f "$ConfigFile" ]; then
45+
Write-PipelineTelemetryError -Category 'Build' "Error: Eng/common/SetupNugetSources.sh returned a non-zero exit code. Couldn't find the NuGet config file: $ConfigFile"
46+
ExitWithExitCode 1
47+
fi
48+
49+
if [ -z "$CredToken" ]; then
50+
Write-PipelineTelemetryError -category 'Build' "Error: Eng/common/SetupNugetSources.sh returned a non-zero exit code. Please supply a valid PAT"
51+
ExitWithExitCode 1
52+
fi
53+
54+
if [[ `uname -s` == "Darwin" ]]; then
55+
NL=$'\\\n'
56+
TB=''
57+
fi
58+
59+
# Ensure there is a <packageSources>...</packageSources> section.
60+
grep -i "<packageSources>" $ConfigFile
61+
if [ "$?" != "0" ]; then
62+
echo "Adding <packageSources>...</packageSources> section."
63+
ConfigNodeHeader="<configuration>"
64+
PackageSourcesTemplate="${TB}<packageSources>${NL}${TB}</packageSources>"
65+
66+
sed -i.bak "s|$ConfigNodeHeader|$ConfigNodeHeader${NL}$PackageSourcesTemplate|" NuGet.config
67+
fi
68+
69+
# Ensure there is a <packageSourceCredentials>...</packageSourceCredentials> section.
70+
grep -i "<packageSourceCredentials>" $ConfigFile
71+
if [ "$?" != "0" ]; then
72+
echo "Adding <packageSourceCredentials>...</packageSourceCredentials> section."
73+
74+
PackageSourcesNodeFooter="</packageSources>"
75+
PackageSourceCredentialsTemplate="${TB}<packageSourceCredentials>${NL}${TB}</packageSourceCredentials>"
76+
77+
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourcesNodeFooter${NL}$PackageSourceCredentialsTemplate|" NuGet.config
78+
fi
79+
80+
PackageSources=()
81+
82+
# Ensure dotnet3-internal and dotnet3-internal-transport are in the packageSources if the public dotnet3 feeds are present
83+
grep -i "<add key=\"dotnet3\"" $ConfigFile
84+
85+
if [ "$?" == "0" ]; then
86+
grep -i "<add key=\"dotnet3-internal\">" $ConfigFile
87+
if [ "$?" != "0" ]; then
88+
echo "Adding dotnet3-internal to the packageSources."
89+
PackageSourcesNodeFooter="</packageSources>"
90+
PackageSourceTemplate="${TB}<add key=\"dotnet3-internal\" value=\"https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal/nuget/v2\" />"
91+
92+
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile
93+
fi
94+
PackageSources+=('dotnet3-internal')
95+
96+
grep -i "<add key=\"dotnet3-internal-transport\"" $ConfigFile
97+
if [ "$?" != "0" ]; then
98+
echo "Adding dotnet3-internal-transport to the packageSources."
99+
PackageSourcesNodeFooter="</packageSources>"
100+
PackageSourceTemplate="${TB}<add key=\"dotnet3-internal-transport\" value=\"https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal-transport/nuget/v2\" />"
101+
102+
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile
103+
fi
104+
PackageSources+=('dotnet3-internal-transport')
105+
fi
106+
107+
# Ensure dotnet3.1-internal and dotnet3.1-internal-transport are in the packageSources if the public dotnet3.1 feeds are present
108+
grep -i "<add key=\"dotnet3.1\"" $ConfigFile
109+
if [ "$?" == "0" ]; then
110+
grep -i "<add key=\"dotnet3.1-internal\"" $ConfigFile
111+
if [ "$?" != "0" ]; then
112+
echo "Adding dotnet3.1-internal to the packageSources."
113+
PackageSourcesNodeFooter="</packageSources>"
114+
PackageSourceTemplate="${TB}<add key=\"dotnet3.1-internal\" value=\"https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v2\" />"
115+
116+
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile
117+
fi
118+
PackageSources+=('dotnet3.1-internal')
119+
120+
grep -i "<add key=\"dotnet3.1-internal-transport\">" $ConfigFile
121+
if [ "$?" != "0" ]; then
122+
echo "Adding dotnet3.1-internal-transport to the packageSources."
123+
PackageSourcesNodeFooter="</packageSources>"
124+
PackageSourceTemplate="${TB}<add key=\"dotnet3.1-internal-transport\" value=\"https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v2\" />"
125+
126+
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile
127+
fi
128+
PackageSources+=('dotnet3.1-internal-transport')
129+
fi
130+
131+
# I want things split line by line
132+
PrevIFS=$IFS
133+
IFS=$'\n'
134+
PackageSources+="$IFS"
135+
PackageSources+=$(grep -oh '"darc-int-[^"]*"' $ConfigFile | tr -d '"')
136+
IFS=$PrevIFS
137+
138+
for FeedName in ${PackageSources[@]} ; do
139+
# Check if there is no existing credential for this FeedName
140+
grep -i "<$FeedName>" $ConfigFile
141+
if [ "$?" != "0" ]; then
142+
echo "Adding credentials for $FeedName."
143+
144+
PackageSourceCredentialsNodeFooter="</packageSourceCredentials>"
145+
NewCredential="${TB}${TB}<$FeedName>${NL}<add key=\"Username\" value=\"dn-bot\" />${NL}<add key=\"ClearTextPassword\" value=\"$CredToken\" />${NL}</$FeedName>"
146+
147+
sed -i.bak "s|$PackageSourceCredentialsNodeFooter|$NewCredential${NL}$PackageSourceCredentialsNodeFooter|" $ConfigFile
148+
fi
149+
done

eng/common/init-tools-native.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ try {
133133
if (Test-Path $InstallBin) {
134134
Write-Host "Native tools are available from" (Convert-Path -Path $InstallBin)
135135
Write-Host "##vso[task.prependpath]$(Convert-Path -Path $InstallBin)"
136-
return $InstallBin
137136
}
138137
else {
139138
Write-Error "Native tools install directory does not exist, installation failed"

0 commit comments

Comments
 (0)