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

[feature] self upgrading release binary #50

Open
kskarthik opened this issue Apr 7, 2024 · 24 comments
Open

[feature] self upgrading release binary #50

kskarthik opened this issue Apr 7, 2024 · 24 comments

Comments

@kskarthik
Copy link
Contributor

kskarthik commented Apr 7, 2024

The idea is to have similar feature to deno upgrade & bun upgrade in which the user can upgrade the existing binary using a cli flag.

This will be a useful feature for many users whose distributions which always do not ship with latest versions of the cli

I wish to work on this patch if we can agree on implementing such feature.

@speatzle
Copy link
Collaborator

speatzle commented Apr 7, 2024

I do not know of any distributions that ships go-passbolt-cli in their repositories, which is why i always planned to provide my own deb and rpm repositories for easy updates but got stalled due to my limited time and low demand.

Would having generic deb and rpm repositories solve your Issue? I think building an Updater from Scratch would be quite complex since it would also need to handle things like man pages and shell completions. The security implications would also have to be considered.

@kskarthik
Copy link
Contributor Author

kskarthik commented Apr 7, 2024

i have initially found this lib which can do the heavy lifing (also includes security aspects like checksum verification) https://github.com/creativeprojects/go-selfupdate

Would having generic deb and rpm repositories solve your Issue?

yes, it would. But it also implies user should add custom repos to their system

@speatzle
Copy link
Collaborator

speatzle commented Apr 8, 2024

I don't see how that library can update additional files like man pages or shell completions (maybe i missed it?). Also if anything goes wrong and can't start it anymore there is no possibility to downgrade again. I generally dislike the Windows Style Self updating.

I don't see adding custom repositories as such a big deal (you also have to do that if you are installing the passbolt server). go-passbolt-cli Simply is not big enough to be included in distros.

I tried to avoid having to add custom repos by looking into packaging the CLI as a Flatpak instead but their CLI Support has "Issues" we would have to work around flatpak/flatpak#1188 .

@kskarthik
Copy link
Contributor Author

I don't see how that library can update additional files like man pages or shell completions (maybe i missed it?). Also if anything goes wrong and can't start it anymore there is no possibility to downgrade again. I generally dislike the Windows Style Self updating.

Yes, The lib i shared does not handle man pages & shell completions.

I tried to avoid having to add custom repos by looking into packaging the CLI as a Flatpak instead but their CLI Support has "Issues" we would have to work around flatpak/flatpak#1188 .

yes, flatpaks are not ideal for CLIs. We have to add an alias & no support for man pages AFAIK

@speatzle
Copy link
Collaborator

speatzle commented Jun 6, 2024

@kskarthik
Copy link
Contributor Author

I have also packaged for opensuse tumbleweed https://build.opensuse.org/request/show/1181068

It takes a few days to land in the main repositories!

@speatzle
Copy link
Collaborator

I have also packaged for opensuse tumbleweed https://build.opensuse.org/request/show/1181068

Cool, i will add that to the Readme once it has been released

@kskarthik
Copy link
Contributor Author

Sure, i will let you know

@kskarthik
Copy link
Contributor Author

kskarthik commented Jul 1, 2024

@kskarthik
Copy link
Contributor Author

It might also reflect here https://repology.org/project/go:passbolt-cli/versions shortly

@speatzle
Copy link
Collaborator

speatzle commented Jul 2, 2024

Cool, i will give it a spin this weekend.

@kskarthik
Copy link
Contributor Author

kskarthik commented Jul 4, 2024

btw is this project still community driven or made official ? since i set the disclaimer in pkg info as well

❯ zypper info go-passbolt-cli
Loading repository data...
Reading installed packages...


Information for package go-passbolt-cli:
----------------------------------------
Repository     : Main Repository (OSS)
Name           : go-passbolt-cli
Version        : 0.3.1-1.1
Arch           : x86_64
Vendor         : openSUSE
Installed Size : 18.5 MiB
Installed      : No
Status         : not installed
Source package : go-passbolt-cli-0.3.1-1.1.src
Upstream URL   : https://github.com/passbolt/go-passbolt-cli
Summary        : A CLI tool to interact with Passbolt
Description    :
    This package provides a CLI tool to interact with Passbolt, An Open
    Source Password Manager for Teams

    Passbolt Website: https://www.passbolt.com/

    This project is community driven and not associated with Passbolt
    SA

@speatzle
Copy link
Collaborator

speatzle commented Jul 4, 2024

Yes, this Project is still Community Driven.

@speatzle
Copy link
Collaborator

speatzle commented Jul 19, 2024

Hey @kskarthik
Sorry for the delay. I finally managed to setup a tumbleweed VM (the first few attempts ended in emergency mode due to broken virtio drivers...) and Test the Package.

It Seems to work well but both shell completions and man pages seem to be missing making it hard to use, could you add those to the package?

You can see how to generate them here: https://github.com/passbolt/go-passbolt-cli/blob/main/.github/workflows/.release.yml

@kskarthik
Copy link
Contributor Author

Sure, I will

@kskarthik
Copy link
Contributor Author

just added shell completions & man page support https://build.opensuse.org/package/rdiff/security:privacy/go-passbolt-cli?opackage=go-passbolt-cli&oproject=openSUSE%3AFactory&rev=4

Will reflect in tumbleweed in a few days

@speatzle
Copy link
Collaborator

I upgraded the package and the man pages work now, it also installed go-passbolt-cli-bash-completions during the upgrade but i can't get the completions to work. Do i need to enable them manually?
image

@kskarthik
Copy link
Contributor Author

kskarthik commented Jul 24, 2024

do you have the bash-completion package installed ?

zypper info bash-completion ?

@speatzle
Copy link
Collaborator

Yes, it was installed automatically:

slt@localhost:~> zypper search passbolt
Loading repository data...
Reading installed packages...

S  | Name                            | Summary                              | Type
---+---------------------------------+--------------------------------------+--------
i+ | go-passbolt-cli                 | A CLI tool to interact with Passbolt | package
i  | go-passbolt-cli-bash-completion | Bash Completion for go-passbolt-cli  | package
   | go-passbolt-cli-fish-completion | Fish Completion for go-passbolt-cli  | package
   | go-passbolt-cli-zsh-completion  | ZSH Completion for go-passbolt-cli   | package
slt@localhost:~> zypper info bash-completion
Loading repository data...
Reading installed packages...


Information for package bash-completion:
----------------------------------------
Repository     : Main Repository (OSS)
Name           : bash-completion
Version        : 2.12.0-2.2
Arch           : noarch
Vendor         : openSUSE
Installed Size : 1003.5 KiB
Installed      : Yes (automatically)
Status         : up-to-date
Source package : bash-completion-2.12.0-2.2.src
Upstream URL   : https://github.com/scop/bash-completion/
Summary        : Programmable Completion for Bash
Description    : 




    bash-completion is a collection of shell functions that take advantage
    of the programmable completion feature of Bash 2.04 and later.

slt@localhost:~> zypper info go-passbolt-cli-bash-completion
Loading repository data...
Reading installed packages...


Information for package go-passbolt-cli-bash-completion:
--------------------------------------------------------
Repository     : Main Repository (OSS)
Name           : go-passbolt-cli-bash-completion
Version        : 0.3.1-2.1
Arch           : noarch
Vendor         : openSUSE
Installed Size : 69.1 KiB
Installed      : Yes (automatically)
Status         : up-to-date
Source package : go-passbolt-cli-0.3.1-2.1.src
Upstream URL   : https://github.com/passbolt/go-passbolt-cli
Summary        : Bash Completion for go-passbolt-cli
Description    : 
    The official bash completion script for go-passbolt-cli, generated during the build.

@kskarthik
Copy link
Contributor Author

@kskarthik
Copy link
Contributor Author

i can see the bash completions listed. do you find any anomaly?

usr/share/man/man1/passbolt.1.gz
/usr/share/bash-completion/completions/go-passbolt-cli

@kskarthik
Copy link
Contributor Author

should the completions match the binary name ?

@speatzle
Copy link
Collaborator

speatzle commented Jul 25, 2024

Moving to file to match the binary name and restarting bash fixed it for me

slt@localhost:~> sudo mv /usr/share/bash-completion/completions/go-passbolt-cli  /usr/share/bash-completion/completions/passbolt
[sudo] password for root: 
slt@localhost:~> bash
slt@localhost:~> passbolt 
configure  create     delete     export     get        help       list       move       share      update     verify     
slt@localhost:~> passbolt list 
folder    group     resource  user      
slt@localhost:~> passbolt list resource 

@kskarthik
Copy link
Contributor Author

ok, i will correct it upstream too

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

No branches or pull requests

2 participants