Create `bbctl update bbctl` command for binary installations
Summary
Create a bbctl update bbctl command. This root command will be used in the future for updating the individual application charts but we should treat the bbctl target as a unique case for upgrading the client itself.
Acceptance Criteria
- When run,
bbctlshould print out instructions to the user to update to the latest version ofbbctlusing curl / tar commands to download a new binary. - The suggested URL should note the correct, latest release
- Support an optional
--versionparameter to generate a download link for a previous version
Relevant logs/screenshots
Coverage of update_test.go:
This screenshot's current coverage hangs at 81.6% coverage
- TODO: Increase coverage to 90%+ ideally
- To increase coverage, we will need to find a way to inject runtime and os variables (ie runtime.GOARCH, runtime.GOOS, os.Executable path) to test for these errors and other options besides the current environment running the tests
- To increase coverage, a suggested solution may be to make an in-house runtime client that wraps all the functions and environmental constants and allows you to return dummy values for testing, then inject that client into your functions in order to force different behaviors in our tests that call upon these runtime and OS functions
- May need to include the following:
filesystemClient, err := factory.GetFileSystemClient()
if err != nil {
return fmt.Errorf("unable to get filesystem client: %w", err)
}
Screenshot of CURL command output working (verified on Linux):
Screenshot of very verbose outputs (OLD, commented out code for self-updating feature #312):
This screenshot's current iteration has a few differences:
- Currently has
fmt.Println()functions all over for verbosity which may or may not be removed/condensed- This includes
BBCTL Compilation Date:in main so I know which build is being run
- This includes
- Currently using
--updates-to-versionflag which will be updated to--versionflag - Currently downloads into
$PATH/TESTfolder which will be updated to$PATH - Currently allows downgrades to happen for verification reasons (couldn't upgrade our current version 0.7.6 with no higher version available) All of which may/will be different in the final iteration.
Edited by Darrien Lee


