From 18b5902d5ea27b3d71aed9f231e79e142ea57c8c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 4 Feb 2021 20:58:50 -0700 Subject: [PATCH 1/2] Propagate failure to install .NET SDK --- tools/Install-DotNetSdk.ps1 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index ec66c949..06710ee3 100755 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -149,10 +149,16 @@ if (-not (Test-Path $DotNetInstallScriptPath)) { } $anythingInstalled = $false +$global:LASTEXITCODE = 0 if ($PSCmdlet.ShouldProcess(".NET Core SDK $sdkVersion", "Install")) { $anythingInstalled = $true Invoke-Expression -Command "$DotNetInstallScriptPath -Version $sdkVersion $switches" + + if ($LASTEXITCODE -ne 0) { + Write-Error ".NET SDK installation failure: $LASTEXITCODE" + exit $LASTEXITCODE + } } else { Invoke-Expression -Command "$DotNetInstallScriptPath -Version $sdkVersion $switches -DryRun" } @@ -163,6 +169,11 @@ $runtimeVersions | Get-Unique |% { if ($PSCmdlet.ShouldProcess(".NET Core runtime $_", "Install")) { $anythingInstalled = $true Invoke-Expression -Command "$DotNetInstallScriptPath -Channel $_ $switches" + + if ($LASTEXITCODE -ne 0) { + Write-Error ".NET SDK installation failure: $LASTEXITCODE" + exit $LASTEXITCODE + } } else { Invoke-Expression -Command "$DotNetInstallScriptPath -Channel $_ $switches -DryRun" } From 5355f205cefddc0b46291cd02ca7e96f9df072d2 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 4 Feb 2021 21:06:04 -0700 Subject: [PATCH 2/2] Use pinned dotnet installer script This unblocks builds by working around https://github.com/dotnet/install-scripts/issues/136 --- tools/Install-DotNetSdk.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index 06710ee3..83ddec87 100755 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -134,10 +134,10 @@ if ($DotNetInstallDir) { } if ($IsMacOS -or $IsLinux) { - $DownloadUri = "https://dot.net/v1/dotnet-install.sh" + $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/1ebb108764c092e7a314ff3fe1388f582cbcf89a/src/dotnet-install.sh" $DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.sh" } else { - $DownloadUri = "https://dot.net/v1/dotnet-install.ps1" + $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/1ebb108764c092e7a314ff3fe1388f582cbcf89a/src/dotnet-install.ps1" $DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.ps1" }