Please, please, please - suggest the use of Net.WebClient instead of Invoke-WebRequest in self-hosted instructions
See original GitHub issueIn Settings/Actions/Runners in a repo, when creating a self-hosted runner, a series of Powershell instructions are presented. Among them is an Invoke-WebRequest call like this:
Invoke-WebRequest -Uri https://github.com/actions/runner/releases/download/v2.285.1/actions-runner-win-x64-2.285.1.zip -OutFile actions-runner-win-x64-2.285.1.zip
Invoke-WebRequest is terribly slow due to it updating the screen during the download. The same download can be made in a one liner like this:
(New-Object Net.WebClient).DownloadFile("https://github.com/actions/runner/releases/download/v2.285.1/actions-runner-win-x64-2.285.1.zip", "$PWD\actions-runner-win-x64-2.285.1.zip")
The performance difference with this ~70mb file?
Invoke-WebRequest: 154.4 seconds Net.WebClient: 3.41 seconds
I think cutting off 151 seconds is a nice thing, no? Could you please replace the suggested command with the faster one (at least for windows?)
Thanks!
- Sean
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:7 (1 by maintainers)
Top GitHub Comments
You’re welcome @slee-accesso, thank you for the reported issue and the proposed solution. Since I’ve created a PR that solves this problem, I’m closing this issue. Please feel free to report if the problem still exists after the PR is merged and shipped to the production.
Thank you, @ruvceskistefan : )