Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@timrogers
Copy link
Contributor

@timrogers timrogers commented Sep 12, 2024

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.

This improves the suggested command, adding a better title to the issue and an explanatory body.

I have tested the resulting command on macOS and Windows, so I am confident that it has at least reasonable cross-platform support.

Fixes #9600.

Testing instructions and sample output

To test this, try installing my timrogers/gh-extension-without-binary extension, which only has an esoteric linux-ppc64 binary 😸:

gh extension install timrogers/gh-extension-without-binary

You'll get a nice (coloured) output like this:

image

...which produces an issue like
timrogers/gh-extension-without-binary#4.

Screenshot 2024-09-12 at 12 31 36

@timrogers timrogers requested a review from a team as a code owner September 12, 2024 11:31
@timrogers timrogers requested a review from jtmcg September 12, 2024 11:31
@cliAutomation cliAutomation added the external pull request originating outside of the CLI core team label Sep 12, 2024
@timrogers timrogers requested a review from jtmcg September 12, 2024 22:20
@timrogers
Copy link
Contributor Author

@jtmcg Just a reminder to take a look at this again ✨

… doesn't have a binary for your platform

When installing an extension, the CLI must to select the correct
binary to download for the machine (see the
[`installBin` function](https://github.com/cli/cli/blob/78c1d00eccac1b2ae82ac0bfeea3e2292c98056a/pkg/cmd/extension/manager.go#L240)).

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](https://github.com/cli/cli/blob/78c1d00eccac1b2ae82ac0bfeea3e2292c98056a/pkg/cmd/extension/manager.go#L278),
directing the user to create an issue on the extension's
repository:

```go
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.

This improves the suggested command, adding a better title
to the issue and an explanatory body.

To test this, try installing my
`timrogers/gh-extension-without-binary` extension, which only has
an esoteric `linux-ppc64` binary 😸:

```bash
gh extension install timrogers/gh-extension-without-binary
```

You'll get a nice output like this:

```
gh-extension-without-binary unsupported for darwin-arm64. Open an issue: `gh issue create -R timrogers/gh-extension-without-binary --title "Add support for the darwin-arm64 architecture" --body "This extension does not support the darwin-arm64 architecture. I tried to install it on a darwin-arm64 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>."`
```

...which produces an issue like
timrogers/gh-extension-without-binary#4.

I have tested the resulting command on macOS and Windows, so
I am confident that it has *at least reasonable* cross-platform
support.

Fixes #9600.
Copy link
Contributor

@jtmcg jtmcg left a comment

Choose a reason for hiding this comment

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

Looking good! One final tweak to the language then :shipit:

Also, apologies for the delay, I just got back from vacation 🏕️

Copy link
Contributor

@jtmcg jtmcg left a comment

Choose a reason for hiding this comment

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

🔥

@timrogers
Copy link
Contributor Author

@jtmcg No worries ❤️ Thanks for the suggestion, and I've also updated the test now.

@jtmcg jtmcg merged commit 65a7e8c into cli:trunk Sep 19, 2024
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Oct 16, 2024
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [cli/cli](https://github.com/cli/cli) | minor | `v2.57.0` -> `v2.58.0` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>cli/cli (cli/cli)</summary>

### [`v2.58.0`](https://github.com/cli/cli/releases/tag/v2.58.0): GitHub CLI 2.58.0

[Compare Source](cli/cli@v2.57.0...v2.58.0)

#### What's Changed

-   Better messaging for `attestation verify` custom issuer mismatch error by [@&#8203;bdehamer](https://github.com/bdehamer) in cli/cli#9616
-   Enhance gh repo create docs, fix random cmd link by [@&#8203;andyfeller](https://github.com/andyfeller) in cli/cli#9630
-   Add HasActiveToken method to AuthConfig to refactor auth check for `attestation trusted-root` command by [@&#8203;BagToad](https://github.com/BagToad) in cli/cli#9635
-   Improve the suggested command for creating an issue when an extension doesn't have a binary for your platform by [@&#8203;timrogers](https://github.com/timrogers) in cli/cli#9608
-   Disable auth check for `attestation trusted-root` command by [@&#8203;bdehamer](https://github.com/bdehamer) in cli/cli#9610
-   build(deps): bump github.com/henvic/httpretty from 0.1.3 to 0.1.4 by [@&#8203;dependabot](https://github.com/dependabot) in cli/cli#9645
-   Fix tenant-awareness for `trusted-root` command by [@&#8203;bdehamer](https://github.com/bdehamer) in cli/cli#9638
-   Replace "GitHub Enterprise Server" option with "other" in gh auth login prompting by [@&#8203;jtmcg](https://github.com/jtmcg) in cli/cli#9642
-   build(deps): bump github.com/cpuguy83/go-md2man/v2 from 2.0.4 to 2.0.5 by [@&#8203;dependabot](https://github.com/dependabot) in cli/cli#9634
-   Add `dnf5` instructions to `docs/install_linux.md` by [@&#8203;its-miroma](https://github.com/its-miroma) in cli/cli#9660
-   build(deps): bump github.com/theupdateframework/go-tuf/v2 from 2.0.0 to 2.0.1 by [@&#8203;dependabot](https://github.com/dependabot) in cli/cli#9688

#### New Contributors

-   [@&#8203;its-miroma](https://github.com/its-miroma) made their first contribution in cli/cli#9660

**Full Changelog**: cli/cli@v2.57.0...v2.58.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM3LjQ0MC43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external pull request originating outside of the CLI core team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants