Commit graph

72 commits

Author SHA1 Message Date
Tim Rogers
1eda1b41a7
Emit a log message when extension installation falls back to a darwin-amd64 binary on an Apple Silicon macOS machine 2024-09-21 14:56:43 -05:00
Tim Rogers
195188cee8
Update pkg/cmd/extension/manager.go
Co-authored-by: Tyler McGoffin <jtmcg@github.com>
2024-09-18 18:55:20 +01:00
Tim Rogers
81d57a0643 Improve error presentation 2024-09-18 14:00:36 +01:00
Tim Rogers
dded039125 Improve the suggested command for creating an issue when an extension 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](78c1d00ecc/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](78c1d00ecc/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
https://github.com/timrogers/gh-extension-without-binary/issues/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 https://github.com/cli/cli/issues/9600.
2024-09-18 14:00:36 +01:00
William Martin
e0fb793b44 Stub hasRosetta for tests 2024-09-12 13:56:19 -06:00
Tim Rogers
5296d60832
Refactor conditions
Co-authored-by: Andy Feller <andyfeller@github.com>
2024-09-12 18:53:24 +01:00
Tim Rogers
a0a2567354
Suggest installing Rosetta when extension installation fails due to missing darwin-arm64 binary, but a darwin-amd64 binary is available
When installing an extension, the CLI must to select the correct
binary to download for the machine (see the
[`installBin` function](78c1d00ecc/pkg/cmd/extension/manager.go (L240))).

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

However, to provide better support for Macs running on Apple
Silicon, it will
[fall back](78c1d00ecc/pkg/cmd/extension/manager.go (L267-L274))
from `darwin-arm64` to `darwin-amd64` if
[Rosetta](https://support.apple.com/en-gb/102527) (Apple's
compatibility layer) is installed.

If Rosetta isn't installed, this fallback doesn't happen, which
can lead to surprising and confusing results when one Mac has
Rosetta and another doesn't, because the extension will install
on one machine but not another.

In the situation where a `darwin-arm64` binary isn't available
but the CLI can't fall back to `amd64` because Rosetta isn't
installed, this updates our error message to suggest installing
Rosetta.

Closes https://github.com/cli/cli/issues/9592.
2024-09-11 11:50:05 +01:00
William Martin
07e0ff7127 Fix repo fork to use remote protocol if none configured 2024-05-10 10:48:36 +02:00
William Martin
1d38230675
Move config interfaces into gh package (#9060) 2024-05-10 10:39:36 +02:00
Sam Coe
7924878315
Fix git protocol and refactor Config interface (#8246) 2023-10-27 15:42:05 +02:00
Mislav Marohnić
beb6234f96
Speed up listing extensions by lazy-loading extension information when needed (#7493) 2023-06-14 09:33:18 +09:00
Sam Coe
39805fa9b1
Properly handle closing files that have been writen to (#7199) 2023-03-23 01:17:47 +00:00
Sam Coe
c9a2d85793
Cleanup config.AuthToken and config.DefaultHost methods (#7049) 2023-02-28 00:24:45 +00:00
vilmibm
fec1f115b0 remove unused args from installGit 2023-01-26 16:05:41 -08:00
Ariel Deitcher
a231b4aded
extension create: make initial commit (#6833) 2023-01-24 17:48:56 +01:00
Des Preston
23913ac371
Show version diff when updating a single extension (#6647) 2022-12-08 14:40:41 +00:00
Sam Coe
6bbfc5056d
Use git client in extension manager (#6547) 2022-11-10 11:38:12 +02:00
Ariel Deitcher
33e589465e
--force overrides pinned extensions (#6513) 2022-11-03 12:12:20 +01:00
Sam Coe
4294ee14a1
revert revert 57fbe4f317 (#6474) 2022-10-20 12:17:20 +00:00
Sam Coe
2cefb9fa59
Fix pr create regression (#6472)
* Revert "Refactor to use new git client (#6447)"

This reverts commit 57fbe4f317.

* Fix pr create regression
2022-10-20 12:46:23 +03:00
Sam Coe
57fbe4f317
Refactor to use new git client (#6447) 2022-10-19 21:11:36 +03:00
Ariel Deitcher
abb8c86ee8
mntly/extension not found (#6425)
Co-authored-by: Mislav Marohnić <mislav@github.com>
2022-10-14 15:27:15 +02:00
casswedson
00bc550dc6 chore: typo hunting ft. codespell 2022-07-09 21:41:09 -05:00
Sam Coe
cacff4ad6d
Use go-gh config package (#5771) 2022-06-23 11:50:04 +00:00
Alexandre Zollinger Chohfi
d1a0f72cd8 Added Arm64 compilation 2022-05-25 16:47:50 -07:00
HÃ¥vard Anda Estensen
58cb773e09
Replace ioutil with io and os (#5498) 2022-04-26 13:07:44 +02:00
Mislav Marohnić
ae0b93575e Add support for installing binary extensions on M1 Macs
If the extension publishes an amd64 binary and Rosetta is available,
use that binary as it will most likely work.

If the extension publishes an arm64 binary, make sure to codesign it
after downloading so that the OS allows its execution.
2022-04-13 20:01:18 +02:00
Sam Coe
2c0236d096
Add extension upgrade --dry-run (#5098) 2022-04-12 07:18:08 +00:00
meiji163
65bc3acaa5 merge upstream 2022-03-07 17:58:48 -08:00
meiji163
aad291a3b8 Merge branch 'tmp' into pin-ext 2022-03-07 17:53:42 -08:00
meiji163
619774d460 fix tests 2022-03-07 17:50:38 -08:00
meiji163
bed630452b list pinned exts 2022-03-07 17:49:04 -08:00
meiji163
db53df102c pinning script exts 2022-03-07 17:02:22 -08:00
meiji163
d7277e396c pinning binary exts 2022-03-07 17:02:22 -08:00
meiji163
f350b917e4 fix tests 2022-03-03 22:10:35 -08:00
meiji163
bdab7de1d2 list pinned exts 2022-03-02 21:06:23 -08:00
meiji163
44334bbec6 pinning script exts 2022-03-02 19:25:25 -08:00
meiji163
15bca56fd2
Merge branch 'cli:trunk' into pin-ext 2022-03-01 15:02:03 -08:00
meiji163
fe5eca1dd5 pinning binary exts 2022-03-01 15:01:04 -08:00
nate smith
c32bf6387e update wording for extensions that cannot be installed 2022-01-19 11:44:05 -06:00
nate smith
562f1b3d0d add GetOrDefault functionality to config 2022-01-11 14:56:58 -06:00
tison
0d3dd7e758
extension upgrade: do not consider up-to-date to be a failure (#4857)
Co-authored-by: Mislav Marohnić <mislav@github.com>
2021-12-16 12:59:22 +01:00
Mislav Marohnić
a65b9a3831 💅 simplify filesystem operations while creating extensions
- doing mkdir before `git init <dir>` is not necessary; git will
  create the directory if it doesn't exist
- passing both `-C` and `--git-dir` is not needed for git invocations
- reading the current working directory isn't necessary for specifying
  nested paths to operate in
- use `git add .` instead of explicitly naming all paths; we generate a
  gitignore for binaries that we want to avoid adding
- generate cross-platform gitignore for Go binary extensions
- add helpers to simplify writing files, tests
2021-11-24 13:46:36 +01:00
vilmibm
6950c6ee32 binary extension create
- add a wizard to gh extension create
- add --precompiled-go
- add --precompiled-other
- build out scaffolding for both types of binary extensions
2021-11-23 16:53:45 -06:00
nate smith
54b82dd072 Migrate to binary style extensions when detected 2021-11-17 13:15:04 -06:00
nate smith
3bc4f4f5dd oops 2021-11-12 15:26:15 -06:00
nate smith
59d651b5ea xplatform test fix 2021-11-12 15:17:21 -06:00
nate smith
6b7889be6e fix binary extensions on windows 2021-11-12 14:29:56 -06:00
nate smith
f65c1537dc review feedback 2021-10-21 11:58:25 -05:00
nate smith
42ce8faafa dispatch binary extensions directly 2021-10-19 14:25:33 -05:00