Commit graph

54 commits

Author SHA1 Message Date
Copilot
ff8873da07
Fix extension install error message showing raw struct instead of owner/repo (#12836)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: williammartin <1611510+williammartin@users.noreply.github.com>
2026-03-05 12:28:54 +01:00
William Martin
49ed6c4681 Use t.Chdir in tests 2025-06-17 11:44:14 +02:00
Andy Feller
41e99b9eab
Merge pull request #9934 from cli/andyfeller/cli-cli-8183-timeout-pt2
Ensure extension update notices only notify once within 24 hours, provide ability to disable all extension update notices
2025-01-13 09:12:32 -05:00
nobe4
3b69ea6fbc
feat: make the extension upgrade fancier
This left-pad the extension names during upgrade so they all align
nicely. It makes easier to see what is happening.
2025-01-07 12:01:02 +01:00
Andy Feller
edc0351c85 Fix failig local extension tests
Extensions have to be gh- prefixed and these newer tests were failing because of expectation.
2024-12-13 23:20:42 -05:00
Andy Feller
bfc63a14cc Implement remaining PR feedback
After merging in upstream changes regarding local extensions, this commit addresses remaining PR feedback while also bringing the newly merged tests into alignment with other changes.
2024-12-13 23:09:18 -05:00
Andy Feller
5ad6ccf73a Merge branch 'trunk' into andyfeller/cli-cli-8183-timeout-pt2 2024-12-13 22:53:13 -05:00
Andy Feller
c12e3694e8 Implement partial feedback before trunk update 2024-12-13 22:52:03 -05:00
Andy Feller
52b845bcad Refactor local installation manager test by OS
- Local extensions on Windows are not symlinks but files whose contents is the path to the local extension directory
- Local extensions elsewhere are symlinks
2024-12-10 22:13:48 -05:00
Andrew Feller
a55f50b115 Remove Extension.FullName() from interface
- this was something I did in the original implementation of this improved extension update notification logic
- discovering other parts of the extension manager code that were working with non-prefixed extension names motivated a different approach
- the extension manager code that requires the extension be prefixed has been enhanced to use the centralized ensurePrefixed() logic, making the need for this on the extension unnecessary
2024-12-08 20:01:26 -05:00
Andrew Feller
97630fe73c Enhance extension manager and tests
- extension manager has been made responsible for extension update directory information
- extension manager has been enhanced to ensure that previously left extension update metadata is deleted before installing an extension
- extension manager has been enhanced to ensure that extension update metadata is deleted when extension is being removed
- refactored extension command tests for manager change, ensuring previous and expected states along with returned release info
- refactored extension manager tests for ensuring previous extension update entries are removed before installing extension
- created extension manager test for installing local extension
- centralized logic for checking and ensuring extension name is "gh-" prefixed
2024-12-08 19:40:24 -05:00
Kynan Ware
b2ab7b84f8 Refactor extension executable error handling 2024-12-08 15:55:09 -07:00
bagtoad
e5eedefd09 Assert stderr is empty in manager_test.go 2024-11-19 16:42:16 -07:00
Kynan Ware
2ec27ff9fe
Update test comments about Windows behavior
Co-authored-by: Tyler McGoffin <jtmcg@github.com>
2024-11-18 16:21:14 -07:00
bagtoad
b575fe8ebc Warn when installing local ext with no executable 2024-11-17 21:01:49 -07:00
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
665e41566f
Fix test 2024-09-18 19:07:32 +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
99b789e745 Add test for extension install fallback to amd64 on darwin 2024-09-13 11:59:54 +02:00
William Martin
e0fb793b44 Stub hasRosetta for tests 2024-09-12 13:56:19 -06:00
Mislav Marohnić
beb6234f96
Speed up listing extensions by lazy-loading extension information when needed (#7493) 2023-06-14 09:33:18 +09:00
Alexander Seiler
218f29f296
Correct some typos 2023-04-21 03:51:31 +02:00
Ariel Deitcher
a231b4aded
extension create: make initial commit (#6833) 2023-01-24 17:48:56 +01: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
Ariel Deitcher
abb8c86ee8
mntly/extension not found (#6425)
Co-authored-by: Mislav Marohnić <mislav@github.com>
2022-10-14 15:27:15 +02:00
HÃ¥vard Anda Estensen
58cb773e09
Replace ioutil with io and os (#5498) 2022-04-26 13:07:44 +02:00
Sam Coe
2c0236d096
Add extension upgrade --dry-run (#5098) 2022-04-12 07:18:08 +00:00
meiji163
8174640cda install tests 2022-03-07 19:47:21 -08:00
meiji163
f350b917e4 fix tests 2022-03-03 22:10:35 -08: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
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
c696416a11 add test 2021-10-19 14:52:14 -05:00
Sam Coe
defbf0f306
Make extension upgrade output more friendly 2021-10-12 16:47:19 -07:00
vilmibm
a2e7eaf808 test update available for binary ext in list 2021-09-29 13:39:00 -05:00
vilmibm
ef08712354 test list 2021-09-28 19:27:21 -05:00
vilmibm
3971df4f93 switch to stubBinaryExtension 2021-09-28 19:23:28 -05:00
vilmibm
392460b81e WIP switching to stubBinaryExtension 2021-09-28 15:45:49 -05:00
vilmibm
541ed3ba6f test Upgrade with binary exts 2021-09-28 15:33:11 -05:00
vilmibm
22c1778b9f TODOs 2021-09-28 15:04:45 -05:00
vilmibm
54ec5329c5 add ability to upgrade binary extensions 2021-09-28 13:03:00 -05:00
vilmibm
db5bbf799f use manager io in Upgrade 2021-09-28 13:03:00 -05:00
vilmibm
514d4d992c refactor dependencies of ext manager 2021-09-21 15:55:31 -05:00
vilmibm
1f3b872859 test for unsupported platform 2021-09-20 17:17:30 -05:00
vilmibm
e85b0480e9 track installed tag name 2021-09-20 17:10:18 -05:00
vilmibm
f5d269ebad WIP refactoring 2021-09-20 17:02:34 -05:00