-
-
Notifications
You must be signed in to change notification settings - Fork 1k
chore: Add retry for curl that download dotnet-install.sh/ps1 #2983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| @ECHO OFF | ||
| PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*; exit $LASTEXITCODE" | ||
| pwsh -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*; exit $LASTEXITCODE" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,11 @@ | ||
| #!/usr/bin/env pwsh | ||
|
|
||
| #Requires -PSEdition Core | ||
|
|
||
| $DotNetInstallerUri = 'https://dot.net/v1/dotnet-install.ps1'; | ||
| $BuildPath = Split-Path $MyInvocation.MyCommand.Path -Parent | ||
| $PSScriptRoot = Split-Path $PSScriptRoot -Parent | ||
|
Comment on lines
+3
to
7
|
||
|
|
||
| if ($PSVersionTable.PSEdition -ne 'Core') { | ||
| # Attempt to set highest encryption available for SecurityProtocol. | ||
| # PowerShell will not set this by default (until maybe .NET 4.6.x). This | ||
| # will typically produce a message for PowerShell v2 (just an info | ||
| # message though) | ||
| try { | ||
| # Set TLS 1.2 (3072), then TLS 1.1 (768), then TLS 1.0 (192), finally SSL 3.0 (48) | ||
| # Use integers because the enumeration values for TLS 1.2 and TLS 1.1 won't | ||
| # exist in .NET 4.0, even though they are addressable if .NET 4.5+ is | ||
| # installed (.NET 4.5 is an in-place upgrade). | ||
| [System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor 768 -bor 192 -bor 48 | ||
| } catch { | ||
| Write-Output 'Unable to set PowerShell to use TLS 1.2 and TLS 1.1 due to old .NET Framework installed. If you see underlying connection closed or trust errors, you may need to upgrade to .NET Framework 4.5+ and PowerShell v3' | ||
| } | ||
| } | ||
|
|
||
| ########################################################################### | ||
| # INSTALL .NET CORE CLI | ||
| ########################################################################### | ||
|
|
@@ -55,7 +41,9 @@ $GlobalJsonPath = Join-Path $SdkPath "global.json" | |
| if (!(Test-Path $InstallPath)) { | ||
| New-Item -Path $InstallPath -ItemType Directory -Force | Out-Null; | ||
| $ScriptPath = Join-Path $InstallPath 'dotnet-install.ps1' | ||
| (New-Object System.Net.WebClient).DownloadFile($DotNetInstallerUri, $ScriptPath); | ||
|
|
||
| curl -LsSfo $ScriptPath $DotNetInstallerUri --retry 5 --retry-delay 5 | ||
|
|
||
| & $ScriptPath -JSonFile $GlobalJsonPath -InstallDir $InstallPath; | ||
|
|
||
| # Install .NET 8 SDK | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing this launcher from
PowerShelltopwshdrops support for environments that only have Windows PowerShell 5.x installed, meaningbuild.cmdwill now fail on such machines unless PowerShell Core is installed; please confirm this breaking change in build requirements is intentional, or add a fallback to Windows PowerShell if Core is unavailable.