question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Please, please, please - suggest the use of Net.WebClient instead of Invoke-WebRequest in self-hosted instructions

See original GitHub issue

In 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:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ruvceskistefancommented, Feb 3, 2022

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.

1reaction
slee-accessocommented, Jan 18, 2022

Thank you, @ruvceskistefan : )

Read more comments on GitHub >

github_iconTop Results From Across the Web

Invoke-WebRequest doesn't work until I call WebClient. ...
I've used powershell to call APIs with self-signed certs before but never had these kind of issues. Resolution: I'd like to call the...
Read more >
Invoke-webrequest downloads a few kb and stops
Hi Community, I have an issue I can re-create and need guidance. I can successfully do a Invoice-Webrequest for tiny files works without ......
Read more >
actions-runner-controller
This controller operates self-hosted runners for GitHub Actions on your Kubernetes cluster. ToC: People; Status; About; Installation.
Read more >
Element Cloud Documentation
However, please consider Can I use a subdomain instead of the root domain with my EMS server? CNAME and .well-known? You need to...
Read more >
Chocolatey Automatic Package Updater Module 2022.10.24
AU is Powershell module that helps you to automate Chocolatey package updates. Features. Use only PowerShell to create automatic update script for given ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found