shorebirdtech / shorebird

Code Push for Flutter and other tools for Flutter businesses.
https://shorebird.dev
Other
1.97k stars 118 forks source link

fix: CLI install script should be robust enough to be able run again after a fail #1942

Open erickzanardo opened 3 weeks ago

erickzanardo commented 3 weeks ago

App ID: 1f375832-2444-4acc-9da9-3e486084c4de

Description

If you run the cli install script and get an error in it, it is not straight forward to run it again.

Steps To Reproduce

1 - Run the install script and make it fail (turn off internet in the middle of the process for example:

arm64  [~/p/g/super_dash_counter][ main][][]  curl --proto '=https' --tlsv1.2 https://raw.githubusercontent.com/shorebirdtech/install/main/install.sh -sSf | bash
Cloning Shorebird into /Users/erickzanardo/.shorebird
Cloning into '/Users/erickzanardo/.shorebird'...
remote: Enumerating objects: 16706, done.
remote: Counting objects: 100% (16706/16706), done.
remote: Compressing objects: 100% (5293/5293), done.
remote: Total 16706 (delta 11547), reused 15597 (delta 10738), pack-reused 0
Receiving objects: 100% (16706/16706), 103.02 MiB | 2.87 MiB/s, done.
Resolving deltas: 100% (11547/11547), done.
Updating Flutter...
Cloning into '/Users/erickzanardo/.shorebird/bin/cache/flutter/47571af6a3acdebedf88255099ff1de1c3324049'...
remote: Enumerating objects: 41002, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (3/3), done.
error: RPC failed; curl 18 HTTP/2 stream 5 was reset.00 KiB/s
error: 7528 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output

2: Try running it again

arm64  [~/p/g/super_dash_counter][ main][][]  curl --proto '=https' --tlsv1.2 https://raw.githubusercontent.com/shorebirdtech/install/main/install.sh -sSf | bash
Error: Existing Shorebird installation detected. Use --force to overwrite.

See that it fails and suggest to use the --force flag. But since the bash command is a curl that is piped to bash, it is not clear where or how that flag should be placed.

Expected Behavior

Install script should either be able to recover from a failure, or it should suggest a more clear option when run again, maybe like a prompt that asks, "Shorebird installation should, would you like to reinstall?"

bryanoltman commented 3 weeks ago

I vote, instead of providing our own install scripts, we move to dart pub global activate. This would require interacting with pub as part of our release process, but would alleviate the many issues users have had with our install scripts and would provide a much cleaner interface for installing than the gnarly bash/powershell commands we're currently asking users to run.