From 3b91f2d78702c2a5538c3f302250952d972bbbda Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 10 Feb 2020 13:34:49 +0000 Subject: [PATCH] Update dependencies from https://github.com/dotnet/arcade build 20200127.3 (#18922) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.20077.3 - Microsoft.DotNet.GenAPI - 1.0.0-beta.20077.3 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.20077.3 --- NuGet.config | 6 +- eng/Version.Details.xml | 132 +++++++++--------- eng/Versions.props | 5 +- eng/common/SetupNugetSources.ps1 | 30 +++- eng/common/SetupNugetSources.sh | 80 +++++++---- eng/common/darc-init.ps1 | 2 +- eng/common/dotnet-install.ps1 | 6 +- eng/common/dotnet-install.sh | 13 +- .../channels/generic-internal-channel.yml | 4 + .../templates/post-build/post-build.yml | 6 + eng/common/tools.ps1 | 41 +++++- eng/common/tools.sh | 26 +++- global.json | 4 +- 13 files changed, 239 insertions(+), 116 deletions(-) diff --git a/NuGet.config b/NuGet.config index 83bc90a901..313ea172cc 100644 --- a/NuGet.config +++ b/NuGet.config @@ -3,8 +3,12 @@ - + + + + + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index fc5c478b72..3929316fcb 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -57,31 +57,31 @@ https://github.com/dotnet/efcore 7ae89d6adb7433b6ae9c37091e57a1226092ef46 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 @@ -101,207 +101,207 @@ https://github.com/aspnet/Extensions 1c5c7777ea9a19d54ab67ec1521665c99460efc5 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 @@ -429,23 +429,23 @@ https://github.com/dotnet/corefx 0f7f38c4fd323b26da10cce95f857f77f0f09b48 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 - + https://github.com/dotnet/arcade - 4d80b9cfa53e309c8f685abff3512f60c3d8a3d1 + 69a67461460d99125742d5c2dd94dad83add84a3 - + https://github.com/dotnet/arcade - 4d80b9cfa53e309c8f685abff3512f60c3d8a3d1 + 69a67461460d99125742d5c2dd94dad83add84a3 - + https://github.com/dotnet/arcade - 4d80b9cfa53e309c8f685abff3512f60c3d8a3d1 + 69a67461460d99125742d5c2dd94dad83add84a3 - + https://github.com/dotnet/extensions 1286a6ff55e300352dabeb6d778c9fcdd258bd08 diff --git a/eng/Versions.props b/eng/Versions.props index 664c95dbeb..b289cd7b39 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -62,7 +62,7 @@ --> - 1.0.0-beta.19607.3 + 1.0.0-beta.20077.3 3.4.1-beta4-19614-01 @@ -266,7 +266,6 @@ $(XunitVersion) $(XunitVersion) 1.0.19249.1 - 3.1.2-servicing.20068.1 3.1.2 @@ -281,4 +280,4 @@ https://dotnetcli.blob.core.windows.net/dotnet/ https://dotnetclimsrc.blob.core.windows.net/dotnet/ - \ No newline at end of file + diff --git a/eng/common/SetupNugetSources.ps1 b/eng/common/SetupNugetSources.ps1 index 2cb40c2947..a8b5280d9d 100644 --- a/eng/common/SetupNugetSources.ps1 +++ b/eng/common/SetupNugetSources.ps1 @@ -16,7 +16,7 @@ # condition: eq(variables['Agent.OS'], 'Windows_NT') # inputs: # filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1 -# arguments: -ConfigFile ${Env:BUILD_SOURCESDIRECTORY}/NuGet.config -Password $Env:Token +# arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $Env:Token # env: # Token: $(dn-bot-dnceng-artifact-feeds-rw) @@ -83,7 +83,7 @@ function AddCredential($creds, $source, $username, $password) { $passwordElement.SetAttribute("value", $Password) } -function InsertMaestroPrivateFeedCredentials($Sources, $Creds, $Password) { +function InsertMaestroPrivateFeedCredentials($Sources, $Creds, $Username, $Password) { $maestroPrivateSources = $Sources.SelectNodes("add[contains(@key,'darc-int')]") Write-Host "Inserting credentials for $($maestroPrivateSources.Count) Maestro's private feeds." @@ -95,10 +95,15 @@ function InsertMaestroPrivateFeedCredentials($Sources, $Creds, $Password) { } if (!(Test-Path $ConfigFile -PathType Leaf)) { - Write-Host "Couldn't find the file NuGet config file: $ConfigFile" + Write-PipelineTelemetryError -Category 'Build' -Message "Eng/common/SetupNugetSources.ps1 returned a non-zero exit code. Couldn't find the NuGet config file: $ConfigFile" ExitWithExitCode 1 } +if (!$Password) { + Write-PipelineTelemetryError -Category 'Build' -Message 'Eng/common/SetupNugetSources.ps1 returned a non-zero exit code. Please supply a valid PAT' + ExitWithExitCode 1 +} + # Load NuGet.config $doc = New-Object System.Xml.XmlDocument $filename = (Get-Item $ConfigFile).FullName @@ -118,10 +123,21 @@ if ($creds -eq $null) { $doc.DocumentElement.AppendChild($creds) | Out-Null } +$userName = "dn-bot" + # Insert credential nodes for Maestro's private feeds -InsertMaestroPrivateFeedCredentials -Sources $sources -Creds $creds -Password $Password +InsertMaestroPrivateFeedCredentials -Sources $sources -Creds $creds -Username $userName -Password $Password -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 -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 +$dotnet3Source = $sources.SelectSingleNode("add[@key='dotnet3']") +if ($dotnet3Source -ne $null) { + AddPackageSource -Sources $sources -SourceName "dotnet3-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal/nuget/v2" -Creds $creds -Username $userName -Password $Password + AddPackageSource -Sources $sources -SourceName "dotnet3-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal-transport/nuget/v2" -Creds $creds -Username $userName -Password $Password +} -$doc.Save($filename) +$dotnet31Source = $sources.SelectSingleNode("add[@key='dotnet3.1']") +if ($dotnet31Source -ne $null) { + AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v2" -Creds $creds -Username $userName -Password $Password + 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 -Password $Password +} + +$doc.Save($filename) \ No newline at end of file diff --git a/eng/common/SetupNugetSources.sh b/eng/common/SetupNugetSources.sh index 1264521317..4ebb1e5a44 100644 --- a/eng/common/SetupNugetSources.sh +++ b/eng/common/SetupNugetSources.sh @@ -17,7 +17,7 @@ # displayName: Setup Private Feeds Credentials # inputs: # filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh -# arguments: $BUILD_SOURCESDIRECTORY/NuGet.config $Token +# arguments: $(Build.SourcesDirectory)/NuGet.config $Token # condition: ne(variables['Agent.OS'], 'Windows_NT') # env: # Token: $(dn-bot-dnceng-artifact-feeds-rw) @@ -42,7 +42,12 @@ scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" . "$scriptroot/tools.sh" if [ ! -f "$ConfigFile" ]; then - echo "Couldn't find the file NuGet config file: $ConfigFile" + Write-PipelineTelemetryError -Category 'Build' "Error: Eng/common/SetupNugetSources.sh returned a non-zero exit code. Couldn't find the NuGet config file: $ConfigFile" + ExitWithExitCode 1 +fi + +if [ -z "$CredToken" ]; then + Write-PipelineTelemetryError -category 'Build' "Error: Eng/common/SetupNugetSources.sh returned a non-zero exit code. Please supply a valid PAT" ExitWithExitCode 1 fi @@ -52,7 +57,7 @@ if [[ `uname -s` == "Darwin" ]]; then fi # Ensure there is a ... section. -grep -i "" $ConfigFile +grep -i "" $ConfigFile if [ "$?" != "0" ]; then echo "Adding ... section." ConfigNodeHeader="" @@ -62,7 +67,7 @@ if [ "$?" != "0" ]; then fi # Ensure there is a ... section. -grep -i "" $ConfigFile +grep -i "" $ConfigFile if [ "$?" != "0" ]; then echo "Adding ... section." @@ -72,37 +77,64 @@ if [ "$?" != "0" ]; then sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourcesNodeFooter${NL}$PackageSourceCredentialsTemplate|" NuGet.config fi -# Ensure dotnet3-internal and dotnet3-internal-transport is in the packageSources -grep -i "" $ConfigFile -if [ "$?" != "0" ]; then - echo "Adding dotnet3-internal to the packageSources." +PackageSources=() - PackageSourcesNodeFooter="" - PackageSourceTemplate="${TB}" +# Ensure dotnet3-internal and dotnet3-internal-transport are in the packageSources if the public dotnet3 feeds are present +grep -i "" $ConfigFile + if [ "$?" != "0" ]; then + echo "Adding dotnet3-internal to the packageSources." + PackageSourcesNodeFooter="" + PackageSourceTemplate="${TB}" + + sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile + fi + PackageSources+=('dotnet3-internal') + + grep -i "" + + sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile + fi + PackageSources+=('dotnet3-internal-transport') fi -# Ensure dotnet3-internal and dotnet3-internal-transport is in the packageSources -grep -i "" $ConfigFile -if [ "$?" != "0" ]; then - echo "Adding dotnet3-internal-transport to the packageSources." +# Ensure dotnet3.1-internal and dotnet3.1-internal-transport are in the packageSources if the public dotnet3.1 feeds are present +grep -i "" - PackageSourcesNodeFooter="" - PackageSourceTemplate="${TB}" + sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile + fi + PackageSources+=('dotnet3.1-internal') - sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" NuGet.config + grep -i "" $ConfigFile + if [ "$?" != "0" ]; then + echo "Adding dotnet3.1-internal-transport to the packageSources." + PackageSourcesNodeFooter="" + PackageSourceTemplate="${TB}" + + sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile + fi + PackageSources+=('dotnet3.1-internal-transport') fi # I want things split line by line PrevIFS=$IFS IFS=$'\n' -PackageSources=$(grep -oh '"darc-int-[^"]*"' $ConfigFile | tr -d '"') +PackageSources+="$IFS" +PackageSources+=$(grep -oh '"darc-int-[^"]*"' $ConfigFile | tr -d '"') IFS=$PrevIFS -PackageSources+=('dotnet3-internal') -PackageSources+=('dotnet3-internal-transport') - for FeedName in ${PackageSources[@]} ; do # Check if there is no existing credential for this FeedName grep -i "<$FeedName>" $ConfigFile @@ -112,6 +144,6 @@ for FeedName in ${PackageSources[@]} ; do PackageSourceCredentialsNodeFooter="" NewCredential="${TB}${TB}<$FeedName>${NL}${NL}${NL}" - sed -i.bak "s|$PackageSourceCredentialsNodeFooter|$NewCredential${NL}$PackageSourceCredentialsNodeFooter|" NuGet.config + sed -i.bak "s|$PackageSourceCredentialsNodeFooter|$NewCredential${NL}$PackageSourceCredentialsNodeFooter|" $ConfigFile fi -done +done \ No newline at end of file diff --git a/eng/common/darc-init.ps1 b/eng/common/darc-init.ps1 index 46d175fdfd..b94c2f4e41 100644 --- a/eng/common/darc-init.ps1 +++ b/eng/common/darc-init.ps1 @@ -27,7 +27,7 @@ function InstallDarcCli ($darcVersion) { Write-Host "Installing Darc CLI version $darcVersion..." Write-Host "You may need to restart your command window if this is the first dotnet tool you have installed." - & "$dotnet" tool install $darcCliPackageName --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity -g + & "$dotnet" tool install $darcCliPackageName --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity -g --framework netcoreapp2.1 } InstallDarcCli $darcVersion diff --git a/eng/common/dotnet-install.ps1 b/eng/common/dotnet-install.ps1 index 0b629b8301..ec3e739fe8 100644 --- a/eng/common/dotnet-install.ps1 +++ b/eng/common/dotnet-install.ps1 @@ -3,7 +3,9 @@ Param( [string] $verbosity = "minimal", [string] $architecture = "", [string] $version = "Latest", - [string] $runtime = "dotnet" + [string] $runtime = "dotnet", + [string] $RuntimeSourceFeed = "", + [string] $RuntimeSourceFeedKey = "" ) . $PSScriptRoot\tools.ps1 @@ -15,7 +17,7 @@ try { if ($architecture -and $architecture.Trim() -eq "x86") { $installdir = Join-Path $installdir "x86" } - InstallDotNet $installdir $version $architecture $runtime $true + InstallDotNet $installdir $version $architecture $runtime $true -RuntimeSourceFeed $RuntimeSourceFeed -RuntimeSourceFeedKey $RuntimeSourceFeedKey } catch { Write-Host $_ diff --git a/eng/common/dotnet-install.sh b/eng/common/dotnet-install.sh index c3072c958a..d259a274c7 100755 --- a/eng/common/dotnet-install.sh +++ b/eng/common/dotnet-install.sh @@ -14,6 +14,8 @@ scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" version='Latest' architecture='' runtime='dotnet' +runtimeSourceFeed='' +runtimeSourceFeedKey='' while [[ $# > 0 ]]; do opt="$(echo "$1" | awk '{print tolower($0)}')" case "$opt" in @@ -29,9 +31,16 @@ while [[ $# > 0 ]]; do shift runtime="$1" ;; + -runtimesourcefeed) + shift + runtimeSourceFeed="$1" + ;; + -runtimesourcefeedkey) + shift + runtimeSourceFeedKey="$1" + ;; *) echo "Invalid argument: $1" - usage exit 1 ;; esac @@ -40,7 +49,7 @@ done . "$scriptroot/tools.sh" dotnetRoot="$repo_root/.dotnet" -InstallDotNet $dotnetRoot $version "$architecture" $runtime true || { +InstallDotNet $dotnetRoot $version "$architecture" $runtime true $runtimeSourceFeed $runtimeSourceFeedKey || { local exit_code=$? echo "dotnet-install.sh failed (exit code '$exit_code')." >&2 ExitWithExitCode $exit_code diff --git a/eng/common/templates/post-build/channels/generic-internal-channel.yml b/eng/common/templates/post-build/channels/generic-internal-channel.yml index 68fdec0290..ad9375f5e5 100644 --- a/eng/common/templates/post-build/channels/generic-internal-channel.yml +++ b/eng/common/templates/post-build/channels/generic-internal-channel.yml @@ -26,6 +26,10 @@ stages: pool: vmImage: 'windows-2019' steps: + # This is necessary whenever we want to publish/restore to an AzDO private feed + - task: NuGetAuthenticate@0 + displayName: 'Authenticate to AzDO Feeds' + - task: DownloadBuildArtifacts@0 displayName: Download Blob Artifacts inputs: diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index 9921743bcd..b121d77e07 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -49,6 +49,12 @@ stages: pool: vmImage: 'windows-2019' steps: + # This is necessary whenever we want to publish/restore to an AzDO private feed + # Since sdk-task.ps1 tries to restore packages we need to do this authentication here + # otherwise it'll complain about accessing a private feed. + - task: NuGetAuthenticate@0 + displayName: 'Authenticate to AzDO Feeds' + - task: DownloadBuildArtifacts@0 displayName: Download Package Artifacts inputs: diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 617db167ce..92a053bd16 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -184,7 +184,14 @@ function InstallDotNetSdk([string] $dotnetRoot, [string] $version, [string] $arc InstallDotNet $dotnetRoot $version $architecture } -function InstallDotNet([string] $dotnetRoot, [string] $version, [string] $architecture = "", [string] $runtime = "", [bool] $skipNonVersionedFiles = $false) { +function InstallDotNet([string] $dotnetRoot, + [string] $version, + [string] $architecture = "", + [string] $runtime = "", + [bool] $skipNonVersionedFiles = $false, + [string] $runtimeSourceFeed = "", + [string] $runtimeSourceFeedKey = "") { + $installScript = GetDotNetInstallScript $dotnetRoot $installParameters = @{ Version = $version @@ -195,10 +202,32 @@ function InstallDotNet([string] $dotnetRoot, [string] $version, [string] $archit if ($runtime) { $installParameters.Runtime = $runtime } if ($skipNonVersionedFiles) { $installParameters.SkipNonVersionedFiles = $skipNonVersionedFiles } - & $installScript @installParameters - if ($lastExitCode -ne 0) { - Write-PipelineTelemetryError -Category "InitializeToolset" -Message "Failed to install dotnet cli (exit code '$lastExitCode')." - ExitWithExitCode $lastExitCode + try { + & $installScript @installParameters + } + catch { + Write-PipelineTelemetryError -Category "InitializeToolset" -Message "Failed to install dotnet runtime '$runtime' from public location." + + # Only the runtime can be installed from a custom [private] location. + if ($runtime -and ($runtimeSourceFeed -or $runtimeSourceFeedKey)) { + if ($runtimeSourceFeed) { $installParameters.AzureFeed = $runtimeSourceFeed } + + if ($runtimeSourceFeedKey) { + $decodedBytes = [System.Convert]::FromBase64String($runtimeSourceFeedKey) + $decodedString = [System.Text.Encoding]::UTF8.GetString($decodedBytes) + $installParameters.FeedCredential = $decodedString + } + + try { + & $installScript @installParameters + } + catch { + Write-PipelineTelemetryError -Category "InitializeToolset" -Message "Failed to install dotnet runtime '$runtime' from custom location '$runtimeSourceFeed'." + ExitWithExitCode 1 + } + } else { + ExitWithExitCode 1 + } } } @@ -228,7 +257,7 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = if ($msbuildCmd -ne $null) { # Workaround for https://github.com/dotnet/roslyn/issues/35793 # Due to this issue $msbuildCmd.Version returns 0.0.0.0 for msbuild.exe 16.2+ - $msbuildVersion = [Version]::new((Get-Item $msbuildCmd.Path).VersionInfo.ProductVersion.Split([char[]]@('-', '+'))[0]) + $msbuildVersion = [Version]::new((Get-Item $msbuildCmd.Path).VersionInfo.ProductVersion.Split(@('-', '+'))[0]) if ($msbuildVersion -ge $vsMinVersion) { return $global:_MSBuildExe = $msbuildCmd.Path diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 757d5b9ea4..94965a8fd2 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -200,8 +200,30 @@ function InstallDotNet { fi bash "$install_script" --version $version --install-dir "$root" $archArg $runtimeArg $skipNonVersionedFilesArg || { local exit_code=$? - Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to install dotnet SDK (exit code '$exit_code')." - ExitWithExitCode $exit_code + Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to install dotnet SDK from public location (exit code '$exit_code')." + + if [[ -n "$runtimeArg" ]]; then + local runtimeSourceFeed='' + if [[ -n "${6:-}" ]]; then + runtimeSourceFeed="--azure-feed $6" + fi + + local runtimeSourceFeedKey='' + if [[ -n "${7:-}" ]]; then + decodedFeedKey=`echo $7 | base64 --decode` + runtimeSourceFeedKey="--feed-credential $decodedFeedKey" + fi + + if [[ -n "$runtimeSourceFeed" || -n "$runtimeSourceFeedKey" ]]; then + bash "$install_script" --version $version --install-dir "$root" $archArg $runtimeArg $skipNonVersionedFilesArg $runtimeSourceFeed $runtimeSourceFeedKey || { + local exit_code=$? + Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to install dotnet SDK from custom location '$runtimeSourceFeed' (exit code '$exit_code')." + ExitWithExitCode $exit_code + } + else + ExitWithExitCode $exit_code + fi + fi } } diff --git a/global.json b/global.json index 073bbbd70c..2fb8f0a8e6 100644 --- a/global.json +++ b/global.json @@ -25,7 +25,7 @@ }, "msbuild-sdks": { "Yarn.MSBuild": "1.15.2", - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19577.5", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19577.5" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.20077.3", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.20077.3" } }