Skip to content

Suggested command for creating an extension when an extension doesn't have a binary for the current architecture creates an unclear, blank issue #9600

Closed

Description

@timrogers

When installing an extension, the CLI must to select the correct binary to download for the machine (see the installBin function).

By default, the CLI will download a binary matching the current machine's architecture.

If a suitable binary isn't available, the CLI outputs an error, directing the user to create an issue on the extension's repository:

if asset == nil {
	return fmt.Errorf(
		"%[1]s unsupported for %[2]s. Open an issue: `gh issue create -R %[3]s/%[1]s -t'Support %[2]s'`",
		repo.RepoName(), platform, repo.RepoOwner())
}

The issue this creates isn't very clear or helpful. It isn't obvious where it is coming from, or what you need to do.

I would propose that we create that issue with a body, e.g.:

This GitHub CLI extension does not support the %[2]s architecture. I tried to install it on a %[2]s machine, and it failed due to the lack of an available binary. Would you be able to update the extension's build and release process to include the relevant binary? For more details, see https://docs.github.com/en/github-cli/github-cli/creating-github-cli-extensions.

This issue body was generated automatically by the GitHub CLI.

Related to #9592.

Activity

  1. added
    needs-triage
    on Sep 11, 2024
  2. timrogers commented on Sep 11, 2024

    @timrogers
    ContributorAuthor

    I'm willing to pick up this change, if the maintainers are happy to accept it 😊

  3. added
    gh-extension
    on Sep 11, 2024
  4. andyfeller commented on Sep 11, 2024

    @andyfeller
    Contributor

    Thanks for raising this concern, @timrogers, definitely an opportunity to improve extension authors and users interactions!

    At first, I was wondering whether there were other situations we could land in this such as the repo not existing, however I see we have that covered:

    func (m *Manager) Install(repo ghrepo.Interface, target string) error {
    isBin, err := isBinExtension(m.client, repo)
    if err != nil {
    if errors.Is(err, releaseNotFoundErr) {
    if ok, err := repoExists(m.client, repo); err != nil {
    return err
    } else if !ok {
    return repositoryNotFoundErr
    }
    } else {
    return fmt.Errorf("could not check for binary extension: %w", err)
    }
    }
    if isBin {
    return m.installBin(repo, target)
    }
    hs, err := hasScript(m.client, repo)
    if err != nil {
    return err
    }
    if !hs {
    return errors.New("extension is not installable: missing executable")
    }
    return m.installGit(repo, target)
    }

    $ gh ext install andyfeller/gh-doesnotexist
    X Could not find extension 'andyfeller/gh-doesnotexist' on host github.com

    The only other scenario being an error with the build process that fails to upload the specific OS + architecture, but realizing that likely warrants asking the extension author to do something regardless.

    What might this look like? 🤔

    • Whatever we output, we should ensure it works for Mac / Windows / Linux users; meaning we probably can't use fancy tricks like sh-style heredocs to generate issue body in an elaborate way:

      For example, cli/cli triage workflow:

      cat << EOF | gh issue create --title "Triage issue \"$TITLE\"" --body-file - --repo "$TARGET_REPO" --label triage
      **Title:** $TITLE
      **Issue:** $LINK
      **Created:** $CREATED
      **Triggered by:** @$TRIGGERED_BY
      
      ---
      
      > $BODY
      EOF
    • Ideally this wouldn't be super verbose command for the user to run

    With all of that said, I think this makes sense and can hold off further feedback for a PR.

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

    gh-extensionneeds-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions