Skip to content

Support cross-platform installation via snap #328

Closed

Description

@psnsilva

Describe the feature or problem you’d like to solve

I would like to have the option to install gh, in Ubuntu, via snap.

Proposed solution

Add gh package to snap. In this early development phase it can be added to the candidate or beta snap channels and when stable add it to the stable channel.

How will it benefit CLI and its users?
Using snap the users will have a cleaner way to ensure that they are always using the latest gh version without the hassle to check for updates and reinstall the *.deb package on every update.

Activity

  1. casperdcl commented on Feb 13, 2020

    @casperdcl

    Just added a package using the an experimental new snapcraft feature (canonical/snapcraft#2911 (comment)) 😄

    I can't PR as the guidelines say they're only looking for bug fixes rather than features.

  2. howbazaar commented on Feb 14, 2020

    @howbazaar

    sudo snap install --edge gh
    [sudo] password for tim:
    error: cannot perform the following tasks:

    • Mount snap "gh" (2) (cannot validate license "MIT License": unexpected string: "License")
  3. casperdcl commented on Feb 14, 2020

    @casperdcl

    Oops, should be fixed now

  4. casperdcl commented on Feb 15, 2020

    @casperdcl

    Btw the snap

    1. Doesn't support opening a browser and fixed now
    2. Doesn't support editing in vim

    @popey I noticed you just forked this, and were also involved in discussions about a vim snap which was meant to be the first classic confinement ever but still doesn't exist. I've tried and couldn't get it to work :/

  5. mislav commented on Feb 19, 2020

    @mislav
    Contributor

    I'm 👎 on providing a snap for this project, mainly because the gh program needs to access the filesystem of the current directory and interface with other commands such as git and vim, and the containment philosophy of snaps restricts all of that. mislav/hub#2434 mislav/hub#2330 mislav/hub#2353 mislav/hub#2479

  6. jayschwa commented on Feb 19, 2020

    @jayschwa

    the gh program needs to access the filesystem of the current directory and interface with other commands such as git and vim, and the containment philosophy of snaps restricts all of that.

    Snaps installed with the --classic confinement are allowed to do those things. However, there is a bug that causes failures when classic snaps interact: https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1849753

  7. casperdcl commented on Feb 19, 2020

    @casperdcl

    I agree that snap restrictions are annoying.

    I put git inside the gh snap (part of the containment philosophy is to not rely on external tools). There's no vim snap afaik so I haven't added that. Opening browsers and authentication via ssh also work.

  8. mislav commented on Feb 19, 2020

    @mislav
    Contributor

    Opening browsers and authentication via ssh also work.

    Oh that's good to know, thank you! I thought that authentication also wouldn't work due to containerization (gh spawns a web server on localhost to act as a callback handler for OAuth).

    We'll keep this open for a while so that we gather more feedback about Snap, and if the community-maintained package proves to be working well, we can recommend installing it in our installation instructions. For now, I feel it's still to early to link this from our README.

  9. casperdcl commented on Feb 19, 2020

    @casperdcl

    Sure. I think the only thing which doesn't work is vim but if you support other editors this would be easy to fix. It looks like other editos are supported by gh with nano as the default so I could fix that too.

  10. casperdcl commented on Feb 20, 2020

    @casperdcl

    Ok I think all features are now supported by (sudo) snap install --edge gh && (sudo) snap connect gh:ssh-keys. Let me know if anything is missing here (or open a PR at https://github.com/casperdcl/cli/pulls).

  11. hackel commented on Feb 20, 2020

    @hackel

    Change the title from "Ubuntu installation" to "Support cross-platform installation via Snap" as this is not Ubuntu specific.

  12. mislav commented on Feb 20, 2020

    @mislav
    Contributor

    Sure. I think the only thing which doesn't work is vim but if you support other editors this would be easy to fix.

    The same way that git allows configuring the editor, we respect GIT_EDITOR, VISUAL, or EDITOR environment variables and execute the path + arguments found within. The gh executable at runtime should then have privileges to execute an arbitrary child process (as specified by the user) and to wait for it to finish. Is this available to a snap running in classic mode?

  13. casperdcl commented on Feb 20, 2020

    @casperdcl

    Classic mode is discouraged in general AFAIK. Right now I've bundled nano and git in the snap, while opening an external browser works without classic. It's 36MB in total so doesn't look like bundling is an issue.

  14. JeremyRubin commented on Aug 24, 2020

    @JeremyRubin

    Would be nice if there was a way to make the snap from an official github/ms account on Snapcraft.

  15. 302 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions