Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: enable self updating CLI #1509

Merged
merged 11 commits into from
Apr 12, 2022
Merged

fix: enable self updating CLI #1509

merged 11 commits into from
Apr 12, 2022

Conversation

wtrocki
Copy link
Collaborator

@wtrocki wtrocki commented Apr 6, 2022

Add ability for CLI to self update itself. This requires more testing with actual release builds and general improvements

This PR will only work for latest release with manual darwin binary.
We need fix upstream: rhysd/go-github-selfupdate#48

Verification

  1. change version in the makefile to 0.1.0
  2. Run make binary
  3. Run rhoas kafka list -v
  4. Press y :D
  5. CLI should be updated.
  6. Execute command again (you should not see any message as CLI have been updated to latest)

Putting binary into system folder would fail and will require sudo to update

@wtrocki wtrocki force-pushed the self-updater branch 2 times, most recently from f594812 to 1af5383 Compare April 6, 2022 22:48
@rkpattnaik780
Copy link
Contributor

Verified after updating golang version in local

@wtrocki
Copy link
Collaborator Author

wtrocki commented Apr 8, 2022

I think we need to test this version over the different machines/operating systems.

@rkpattnaik780 do you mind creating alpha release with this version so we can test it end to end on platforms like windows, mac and linux?

@rkpattnaik780
Copy link
Contributor

I think we need to test this version over the different machines/operating systems.

@rkpattnaik780 do you mind creating alpha release with this version so we can test it end to end on platforms like windows, mac and linux?

On it!

@rkpattnaik780
Copy link
Contributor

We will need to bump version in release workflow to 1.18x in order to create an alpha release.

@wtrocki
Copy link
Collaborator Author

wtrocki commented Apr 8, 2022

Done little bit testing on the windows and mac. All seems to be working fine but additional changes are needed to inform user about update and add note that we need sudo if cli is located in folder that user cannot have write permission.

@wtrocki
Copy link
Collaborator Author

wtrocki commented Apr 11, 2022

Updated version now asks users for permission and also mention that root is required.

[wtrocki@graphapi app-services-cli (self-updater ✗)]$ rhoas status
? New version of the RHOAS CLI detected. 
Do you want CLI to be updated to the latest version now?  

NOTE: You might need to run the CLI as root to make sure that binary file can be updated.
 Yes
RHOAS CLI updated to version 0.39.1

@wtrocki
Copy link
Collaborator Author

wtrocki commented Apr 11, 2022

This is ready to be reviewed.

@wtrocki
Copy link
Collaborator Author

wtrocki commented Apr 11, 2022

cmd/rhoas/main.go Outdated Show resolved Hide resolved
@wtrocki wtrocki requested a review from rkpattnaik780 April 12, 2022 09:22
@wtrocki
Copy link
Collaborator Author

wtrocki commented Apr 12, 2022

Looking for review :D

Copy link
Contributor

@rkpattnaik780 rkpattnaik780 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified with linux! Works great :D

@wtrocki wtrocki merged commit f0cf730 into main Apr 12, 2022
@wtrocki wtrocki deleted the self-updater branch April 12, 2022 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants