Commit graph

7910 commits

Author SHA1 Message Date
bagtoad
25cdce2cec Update license table headings and tests 2024-09-29 11:59:15 -06:00
bagtoad
2b4464a3af Fix ListLicenseTemplates doc 2024-09-29 11:49:09 -06:00
bagtoad
ac779ba82a fix output capitalization 2024-09-29 11:48:48 -06:00
bagtoad
2f608e3772 Cleanup rendering and tests 2024-09-29 11:46:37 -06:00
bagtoad
1aa2a824ba Remove json output option
Because the API query uses REST, the JSON exporter doesn't work as expected.
2024-09-29 11:00:29 -06:00
bagtoad
21f0d9466e Divide shared repo package and add queries tests 2024-09-29 10:40:22 -06:00
bagtoad
fd8c4633e3 First pass at implementing gh repo license list 2024-09-23 12:30:02 -06:00
Tyler McGoffin
e63dc2216b
Merge pull request #9645 from cli/dependabot/go_modules/github.com/henvic/httpretty-0.1.4
build(deps): bump github.com/henvic/httpretty from 0.1.3 to 0.1.4
2024-09-20 14:37:42 -07:00
dependabot[bot]
1ef71409f3
build(deps): bump github.com/henvic/httpretty from 0.1.3 to 0.1.4
Bumps [github.com/henvic/httpretty](https://github.com/henvic/httpretty) from 0.1.3 to 0.1.4.
- [Commits](https://github.com/henvic/httpretty/compare/v0.1.3...v0.1.4)

---
updated-dependencies:
- dependency-name: github.com/henvic/httpretty
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-20 14:11:28 +00:00
Brian DeHamer
d451a4341b
Merge pull request #9610 from cli/bdehamer/disable-attestation-trusted-root-auth-check
Disable auth check for `attestation trusted-root` command
2024-09-19 12:28:25 -07:00
Tyler McGoffin
65a7e8c4f7
Merge pull request #9608 from timrogers/timrogers/extension-binary-command
Improve the suggested command for creating an issue when an extension doesn't have a binary for your platform
2024-09-19 09:11:49 -07:00
Brian DeHamer
337b284820
Merge branch 'trunk' into bdehamer/disable-attestation-trusted-root-auth-check 2024-09-19 07:07:26 -07:00
Brian DeHamer
49892e8bbc
Merge pull request #9635 from cli/bagtoad/cli-9610-add-HasActiveToken-to-AuthConfig
Add HasActiveToken method to AuthConfig to refactor auth check for `attestation trusted-root` command
2024-09-18 13:58:17 -07:00
Andy Feller
71b2aeab75
Merge pull request #9630 from cli/andyfeller/8946-repo-create-license-gitignore-docs
Enhance gh repo create docs, fix random cmd link
2024-09-18 14:47:06 -04:00
Tim Rogers
665e41566f
Fix test 2024-09-18 19:07:32 +01: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
bagtoad
d24dfbeacf Update comment formatting 2024-09-18 10:35:35 -06:00
bagtoad
d8e77d256f Use new HasActiveToken method in trustedroot.go 2024-09-18 10:35:11 -06:00
bagtoad
88d48f2365 Add HasActiveToken method to AuthConfig interface 2024-09-18 10:32:58 -06:00
bagtoad
e7403b89d0 Add HasActiveToken to AuthConfig.
Co-authored-by: William Martin <williammartin@users.noreply.github.com>
2024-09-18 08:42:19 -06: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
Brian DeHamer
3bcedfe7f0
Update pkg/cmd/attestation/trustedroot/trustedroot_test.go
Co-authored-by: Fredrik Skogman <kommendorkapten@github.com>
2024-09-17 14:18:00 -07:00
Brian DeHamer
cbe8525321
enforce auth for tenancy
Signed-off-by: Brian DeHamer <bdehamer@github.com>
2024-09-16 13:52:57 -07:00
Brian DeHamer
8e8fc696f1
disable auth check for att trusted-root cmd
Signed-off-by: Brian DeHamer <bdehamer@github.com>
2024-09-16 12:55:18 -07:00
Brian DeHamer
2e13ec5d80
Merge pull request #9616 from cli/bdehamer/custom-issuer-error
Better messaging for `attestation verify` custom issuer mismatch error
2024-09-16 12:52:12 -07:00
Brian DeHamer
8c8423aa3d
better error for att verify custom issuer mismatch
Signed-off-by: Brian DeHamer <bdehamer@github.com>
Co-authored-by: Zach Steindler <steiza@github.com>
Co-authored-by: Phill MV <phillmv@github.com>
2024-09-16 12:38:12 -07:00
Andy Feller
24336f1344 Enhance gh repo create docs, fix random cmd link
Relates #8946

- updates the documentation within `gh repo create` to include links to lookup .gitignore templates and licenses
- fixes link markup within `gh auth setup-git` so link is formatted correctly on https://cli.github.com
2024-09-16 13:42:51 -04:00
Andy Feller
d108784d7f
Merge pull request #9618 from cli/wm/tenant-api
Use api subdomains for tenant hosts
2024-09-16 09:53:44 -04:00
William Martin
420d80b498 Update go-gh to use api subdomains 2024-09-16 15:21:42 +02:00
Meredith Lancaster
0f42ee46f0
Merge pull request #9612 from cli/bdehamer/attest-verify-no-tty
Suppress `attestation verify` output when no TTY present
2024-09-13 10:01:02 -06:00
Meredith Lancaster
e381d54511
Merge pull request #9564 from malancas/verification-err-output
Update `gh attestation verify` bundle parsing and validation errors
2024-09-13 09:27:07 -06:00
William Martin
352737cb60 Use api subdomains for commands using ghinstance package 2024-09-13 15:03:36 +02:00
William Martin
4430c40298
Merge pull request #9599 from timrogers/timrogers/extension-arm64
Suggest installing Rosetta when extension installation fails due to missing `darwin-arm64` binary, but a `darwin-amd64` binary is available
2024-09-13 13:52:09 +02: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
Tim Rogers
5296d60832
Refactor conditions
Co-authored-by: Andy Feller <andyfeller@github.com>
2024-09-12 18:53:24 +01:00
Brian DeHamer
677edbac77
suppress att verify output when no tty
Signed-off-by: Brian DeHamer <bdehamer@github.com>
2024-09-12 09:40:47 -07:00
Brian DeHamer
c57a045d2d
Merge pull request #9595 from cli/bdehamer/attest-verify-test-custom-issuer
`gh attestation verify` test for custom OIDC issuers
2024-09-12 06:51:05 -07:00
Brian DeHamer
f128ae8349
add att verify test for custom OIDC issuer
Signed-off-by: Brian DeHamer <bdehamer@github.com>
2024-09-11 12:49:06 -07:00
William Martin
3cbaffebb6
Merge pull request #9601 from cli/dependabot/go_modules/github.com/sigstore/sigstore-go-0.6.2
build(deps): bump github.com/sigstore/sigstore-go from 0.6.1 to 0.6.2
2024-09-11 16:58:32 +02:00
dependabot[bot]
fbdf0ccb75
build(deps): bump github.com/sigstore/sigstore-go from 0.6.1 to 0.6.2
Bumps [github.com/sigstore/sigstore-go](https://github.com/sigstore/sigstore-go) from 0.6.1 to 0.6.2.
- [Release notes](https://github.com/sigstore/sigstore-go/releases)
- [Commits](https://github.com/sigstore/sigstore-go/compare/v0.6.1...v0.6.2)

---
updated-dependencies:
- dependency-name: github.com/sigstore/sigstore-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-11 14:39:44 +00:00
Andy Feller
22c1da07a2
Merge pull request #9520 from velumuruganr/auth-status-active
Added `--active` flag to the `gh auth status` command
2024-09-11 10:35:39 -04: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
Fredrik Skogman
aa931c5aa7
Merge pull request #9542 from kommendorkapten/policy-tenancy
Added tenancy aware attestation commands
2024-09-11 11:53:30 +02:00
Fredrik Skogman
1b59ec8ad0
This commit introduces tenancy aware attestation policy building.
This is done by inspecting the current hostname to determine if
tenancy is enabled.

The attestation commands also accepts a --hostname parameter, that
is used to pick the current host, similar to how the GH_HOST variable
can be used.

Signed-off-by: Fredrik Skogman <kommendorkapten@github.com>
2024-09-11 10:49:17 +02:00
Meredith Lancaster
e2c33e5cc1 use sigstore-go v0.6.2
Signed-off-by: Meredith Lancaster <malancas@github.com>
2024-09-10 13:07:52 -06:00
Meredith Lancaster
50d335566d check specific err
Signed-off-by: Meredith Lancaster <malancas@github.com>
2024-09-10 10:47:06 -06:00
Meredith Lancaster
3814e82f9b check err in GetLocalAttestations
Signed-off-by: Meredith Lancaster <malancas@github.com>
2024-09-10 10:32:46 -06:00
Meredith Lancaster
f748f9e65f Merge remote-tracking branch 'upstream/trunk' into verification-err-output 2024-09-10 09:04:57 -06:00