-
-
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?
Conversation
ce1596f to
f87af3f
Compare
|
I've modified scripts to use By this change, |
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.
Pull request overview
This PR hardens the CI/local build bootstrap by adding retries to the dotnet-install download and standardizing on PowerShell Core for the Windows build entrypoint.
Changes:
- Add
curlretry options (--retry 5 --retry-delay 5) and-Sto surface download failures when fetchingdotnet-install.shanddotnet-install.ps1. - Switch the PowerShell build script to run under PowerShell Core (
pwsh) with a#Requires -PSEdition Coredirective. - Update Windows build documentation and
build.batto reflect and use PowerShell Core instead of Windows PowerShell.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| docs/articles/contributing/building.md | Updates Windows prerequisites to require PowerShell Core, aligning docs with the new build script behavior. |
| build/build.sh | Uses curl -LsSfo ... --retry 5 --retry-delay 5 to download dotnet-install.sh more robustly before running it. |
| build/build.ps1 | Enforces PowerShell Core, replaces WebClient.DownloadFile with a curl-based download that includes retries and error output. |
| build/build.bat | Changes the Windows launcher to invoke pwsh instead of PowerShell, so the build runs under PowerShell Core. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #Requires -PSEdition Core | ||
|
|
||
| $DotNetInstallerUri = 'https://dot.net/v1/dotnet-install.ps1'; | ||
| $BuildPath = Split-Path $MyInvocation.MyCommand.Path -Parent | ||
| $PSScriptRoot = Split-Path $PSScriptRoot -Parent |
Copilot
AI
Jan 28, 2026
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.
With #Requires -PSEdition Core at the top, this script can never run on non-Core PowerShell, so the compatibility block that checks $PSVersionTable.PSEdition -ne 'Core' and configures legacy TLS behavior a few lines below is now effectively dead code; consider removing that block to avoid confusion and keep the script focused on the supported runtime.
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.
the compatibility block that checks $PSVersionTable.PSEdition -ne 'Core' and configures legacy TLS behavior a few lines below is now effectively dead code
I've removed dead code on latest commit (a731881)
| @@ -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" No newline at end of file | |||
| pwsh -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*; exit $LASTEXITCODE" No newline at end of file | |||
Copilot
AI
Jan 28, 2026
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 PowerShell to pwsh drops support for environments that only have Windows PowerShell 5.x installed, meaning build.cmd will 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.
This PR intended to fix transient error on CI when downloading
dotnet-install.ps1/dotnet-install.sh.Background
I've recently encountered following errors on CI multiple times.
It seems to be failed to download
dotnet-install.ps1/dotnet-install.shwith temporary network errors.Currently curl is executed on
-Lsfooption so error is silently ignored.So I've added
Soption to show failure on script download.And I've added following setting to reduce transient errors.
On windows environment.
I've also modified to use
curlexecutable instead ofInvoke-WebRequest