Skip to content

sg: autoupdates now use binary releases rather that compiling sg

Administrator requested to merge devx/sg-downloading-updates into main

Created by: jhchabran

As pointed out by @bobheadxi, depending on your machine, rebuilding sg can vary a lot in duration. On my heavy machine, it takes less than 10 seconds, but it can go up to 30s on @bobheadxi's machine.

This really affects the user experience.

This PR adds a -download flag to sg update, which is always enabled when an auto-update is run.

~/work/sourcegraph/dev/sg U devx/sg-downloading-updates $ time sg help
?? Auto updating sg ...
USAGE
  sg [flags] <subcommand>
# (...)
error: flag: help requested
sg help  0.99s user 2.17s system 71% cpu 4.441 total

It's now down to 5 seconds, and will only depend on your connection, though that should be much more stable across different machines as we all have decent connections.

There is a very small time window where a commit affecting sg has been pushed to main but hasn't yet run on the GitHub action. But looking at the releases timestamps, that window is below a few minutes. If the user were to be in that window, in the worst-case scenario, a new update will happen on the next git fetch, which, considering its just 5 seconds, is fine.

Bonus: because the download mechanism does not stash, it will stop bothering editors which will detect the file having changed on the disk even though the stash part did restore them afterward.

Test plan

  • Tested manually in local.

Merge request reports

Loading