Commit graph

128 commits

Author SHA1 Message Date
Meredith Lancaster
f43ec0079b add test for predicate type filtering
Signed-off-by: Meredith Lancaster <malancas@github.com>
2025-04-01 11:52:13 -06:00
Meredith Lancaster
f3982b278c add more verification integration tests
Signed-off-by: Meredith Lancaster <malancas@github.com>
2024-12-16 16:57:05 -07:00
Meredith Lancaster
2393725469 hard code expected digest
Signed-off-by: Meredith Lancaster <malancas@github.com>
2024-12-11 08:13:30 -07:00
Meredith Lancaster
35b5606937 fix download test
Signed-off-by: Meredith Lancaster <malancas@github.com>
2024-12-11 08:04:02 -07:00
Meredith Lancaster
2ced59fba3 update integration test scripts
Signed-off-by: Meredith Lancaster <malancas@github.com>
2024-12-11 07:42:05 -07:00
Meredith Lancaster
b6c2b4ff2a try nesting scripts
Signed-off-by: Meredith Lancaster <malancas@github.com>
2024-12-10 11:58:23 -07:00
Meredith Lancaster
050f295b37 run all tests in a single script
Signed-off-by: Meredith Lancaster <malancas@github.com>
2024-12-10 11:41:15 -07:00
Meredith Lancaster
67798b06c0 use github owned oci image
Signed-off-by: Meredith Lancaster <malancas@github.com>
2024-12-06 08:32:16 -07:00
Meredith Lancaster
7e69c0d4ab fix package reference
Signed-off-by: Meredith Lancaster <malancas@github.com>
2024-12-05 10:06:26 -07:00
Meredith Lancaster
006ed7b5b5 add gh attestation verify integration test for oci bundles
Signed-off-by: Meredith Lancaster <malancas@github.com>
2024-12-05 10:02:01 -07:00
Meredith Lancaster
c465d465a5
Update sigstore-go dependency to v0.3.0 (#8977)
* update sigstore-go dep to v0.3.0

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add integration test to verify newer sigstore bundle versions

Signed-off-by: Meredith Lancaster <malancas@github.com>

* Fix shellcheck issues

Signed-off-by: Meredith Lancaster <malancas@github.com>

* Give the cli/package-security team ownership over gh attestation cmd integration tests

Signed-off-by: Meredith Lancaster <malancas@github.com>

* fetch attestation file

Signed-off-by: Meredith Lancaster <malancas@github.com>

* clean up new integration test

Signed-off-by: Meredith Lancaster <malancas@github.com>

* try pulling other attestation file

Signed-off-by: Meredith Lancaster <malancas@github.com>

* cleanup new attestation verify integration test

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add new gh atestation integration test to workflow

Signed-off-by: Meredith Lancaster <malancas@github.com>

* mark script as executable

Signed-off-by: Meredith Lancaster <malancas@github.com>

* rename the integration test file

Signed-off-by: Meredith Lancaster <malancas@github.com>

---------

Signed-off-by: Meredith Lancaster <malancas@github.com>
2024-04-23 07:07:23 -06:00
Meredith Lancaster
90b7bf97c5
gh-attestation cmd integration (#8698)
* add attestation cmd

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add codeowners

Signed-off-by: Meredith Lancaster <malancas@github.com>

* update args passed to the attestation cmd

Signed-off-by: Meredith Lancaster <malancas@github.com>

* rename file

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use gh-attestation branch for passing iostreams from the root

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add package security team entry to codeowners

Signed-off-by: Meredith Lancaster <malancas@github.com>

* start moving over verify cmd and general verification code

Signed-off-by: Meredith Lancaster <malancas@github.com>

* clean up common and verify specific policy code

Signed-off-by: Meredith Lancaster <malancas@github.com>

* move artifact package over

Signed-off-by: Meredith Lancaster <malancas@github.com>

* start pulling in the github api client wrapper

Signed-off-by: Meredith Lancaster <malancas@github.com>

* fix imports

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add logger and test packages

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add additional packages to support verify command

Signed-off-by: Meredith Lancaster <malancas@github.com>

* fix mock api client

Signed-off-by: Meredith Lancaster <malancas@github.com>

* clean up mock api client

Signed-off-by: Meredith Lancaster <malancas@github.com>

* include missing fields

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use correct owner

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add more mock api client options

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add download cmd

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add inspect cmd

Signed-off-by: Meredith Lancaster <malancas@github.com>

* pass factory object to inspect cmd, add inspect sub cmd to attestation cmd

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add verify-tuf-root cmd

Signed-off-by: Meredith Lancaster <malancas@github.com>

* pass iostream struct from command

Signed-off-by: Meredith Lancaster <malancas@github.com>

* rename logger pkg to logger

Signed-off-by: Meredith Lancaster <malancas@github.com>

* fix path in codeowners

Signed-off-by: Meredith Lancaster <malancas@github.com>

* formatter

Signed-off-by: Meredith Lancaster <malancas@github.com>

* go mod tidy

Signed-off-by: Meredith Lancaster <malancas@github.com>

* fix printf linter issue

Signed-off-by: Meredith Lancaster <malancas@github.com>

* fix printf linter issue

Signed-off-by: Meredith Lancaster <malancas@github.com>

* check user's GH host for compatibility

Signed-off-by: Meredith Lancaster <malancas@github.com>

* pass oci client to commands directly

Signed-off-by: Meredith Lancaster <malancas@github.com>

* rename command

Signed-off-by: Meredith Lancaster <malancas@github.com>

* mark tuf-root-verify cmd hidden

Signed-off-by: Meredith Lancaster <malancas@github.com>

* move client initialization back to subcommands

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add more verbose options and logging

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add missing logger

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add testing around OCI and API client

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add integration test

Signed-off-by: Meredith Lancaster <malancas@github.com>

* fix file path

Signed-off-by: Meredith Lancaster <malancas@github.com>

* fix command

Signed-off-by: Meredith Lancaster <malancas@github.com>

* build executable before integration test

Signed-off-by: Meredith Lancaster <malancas@github.com>

* split integration tests

Signed-off-by: Meredith Lancaster <malancas@github.com>

* remove integration test steps

Signed-off-by: Meredith Lancaster <malancas@github.com>

* fix flag value

Signed-off-by: Meredith Lancaster <malancas@github.com>

* run integration tests on ubuntu for now

Signed-off-by: Meredith Lancaster <malancas@github.com>

* pull over doc updates

Signed-off-by: Meredith Lancaster <malancas@github.com>

* delete unused test data

Signed-off-by: Meredith Lancaster <malancas@github.com>

* remove Go patch version

Signed-off-by: Meredith Lancaster <malancas@github.com>

* switch assert to require

Signed-off-by: Meredith Lancaster <malancas@github.com>

* rename file

Signed-off-by: Meredith Lancaster <malancas@github.com>

* move integration tests to prexisting test workflow

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use platform matrix for integration tests

Signed-off-by: Meredith Lancaster <malancas@github.com>

* simplify build step

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use StringEnumFlag handling

Signed-off-by: Meredith Lancaster <malancas@github.com>

* typo

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use the iostreams.Test helper func

Signed-off-by: Meredith Lancaster <malancas@github.com>

* create interface for oci client

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add tests for oci client

Signed-off-by: Meredith Lancaster <malancas@github.com>

* rename files

Signed-off-by: Meredith Lancaster <malancas@github.com>

* format file

Signed-off-by: Meredith Lancaster <malancas@github.com>

* fix shellcheck issues

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use testing TempDir method

Signed-off-by: Meredith Lancaster <malancas@github.com>

* cleanup unused tempdir handling

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use table driven tests

Signed-off-by: Meredith Lancaster <malancas@github.com>

* check correct cmd

Signed-off-by: Meredith Lancaster <malancas@github.com>

* support repo option in download sub cmd

Signed-off-by: Meredith Lancaster <malancas@github.com>

* switch over to using RunE

Signed-off-by: Meredith Lancaster <malancas@github.com>

* unexport top level subcommand funcs

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add comment around keychain option

Signed-off-by: Meredith Lancaster <malancas@github.com>

* update comments

Signed-off-by: Meredith Lancaster <malancas@github.com>

* fix inconsistent naming

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add tests for CLI commands

Signed-off-by: Meredith Lancaster <malancas@github.com>

* check for noattestationsfound err

Signed-off-by: Meredith Lancaster <malancas@github.com>

* try out metadata abstraction instead

Signed-off-by: Meredith Lancaster <malancas@github.com>

* switch to using MetadataStore abstraction

Signed-off-by: Meredith Lancaster <malancas@github.com>

* include test case with failing metadata store

Signed-off-by: Meredith Lancaster <malancas@github.com>

* look for err specific to file write

Signed-off-by: Meredith Lancaster <malancas@github.com>

* unexport fields

Signed-off-by: Meredith Lancaster <malancas@github.com>

* return err when an unsupported hash alg is provided

Signed-off-by: Meredith Lancaster <malancas@github.com>

* PrintTableToStdOut returns err when rendering fails

Signed-off-by: Meredith Lancaster <malancas@github.com>

* start adding sigstore verifier unit tests

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add more sigstore verifier specific tests

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use cli table printer

Signed-off-by: Meredith Lancaster <malancas@github.com>

* return JSON results in slice instead of table

Signed-off-by: Meredith Lancaster <malancas@github.com>

* move mock client to test file

Signed-off-by: Meredith Lancaster <malancas@github.com>

* remove unneeded table printer method

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add initial tests for tufrootverify cmd

Signed-off-by: Meredith Lancaster <malancas@github.com>

* formatting

Signed-off-by: Meredith Lancaster <malancas@github.com>

* cleanup method

Signed-off-by: Meredith Lancaster <malancas@github.com>

* close file in error handling branch

Signed-off-by: Meredith Lancaster <malancas@github.com>

* normalize artifact path

Signed-off-by: Meredith Lancaster <malancas@github.com>

* remove unneeded embedded file system

Signed-off-by: Meredith Lancaster <malancas@github.com>

* include image name reference err

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use GH_DEBUG value for io handling

Signed-off-by: Meredith Lancaster <malancas@github.com>

* remove quiet and verbose flags

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add more tufrootveriify tests

Signed-off-by: Meredith Lancaster <malancas@github.com>

* GitHubTUFOptions no longer needs to return error

Signed-off-by: Meredith Lancaster <malancas@github.com>

* remove unneeded slice

Signed-off-by: Meredith Lancaster <malancas@github.com>

* normalize all relative paths

Signed-off-by: Meredith Lancaster <malancas@github.com>

* clean up nil client checks

Signed-off-by: Meredith Lancaster <malancas@github.com>

* set api server based on host

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add comment about http client

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use format flag to handle json output in verify cmd

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use format flag to handle json output

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use normalized path for cli test arg

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add tests for json output

Signed-off-by: Meredith Lancaster <malancas@github.com>

* cleanup error wrapping

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use test fixtures correctly by normalizing path

Signed-off-by: Meredith Lancaster <malancas@github.com>

* dont clean

Signed-off-by: Meredith Lancaster <malancas@github.com>

* escape backwards slash for windows files with replace

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use strings.Split func

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use strings.Replace for all command tests

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use CLI cache dir to store tuf metadata

Signed-off-by: Meredith Lancaster <malancas@github.com>

* Tweaked docstrings for gh attestation download

* Tweaked docstrings for gh attestation verify

* Fix for bug in gh attestation where the wrong hostname was being passed to the API client.

* lets hide tuf-root-verify eh?

* Forgot verify's short str.

* add remote verification test

Signed-off-by: Meredith Lancaster <malancas@github.com>

* Revert "add remote verification test"

This reverts commit c0ceb99ca8.

* update json result handling

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add json tags to struct returned by command

Signed-off-by: Meredith Lancaster <malancas@github.com>

* fix how json results are handled

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add test to ensure JSON output is valid

Signed-off-by: Meredith Lancaster <malancas@github.com>

---------

Signed-off-by: Meredith Lancaster <malancas@github.com>
Co-authored-by: Phill MV <phillmv@github.com>
2024-04-01 11:13:47 -06:00
Mislav Marohnić
111e8dbcf2 Pass web browser to each individual command
This removes sensitivity to the BROWSER environment variable in tests
and makes it easier to verify the URL that the browser was invoked with
without having to stub sub-processes.
2021-03-19 21:22:37 +01:00
Devon Romanko
5d23f116c9 removed no longer used CmdStubber 2021-01-23 08:22:14 -05:00
Mislav Marohnić
fc77cbc964 Deprecate test.ExpectLines
For asserting command output, exact string matches are preferred in most cases. In cases when a pattern match is needed, the test can use regexp ad hoc.
2021-01-18 23:25:45 +01:00
Mislav Marohnić
411bd4a70e 🔥 unused test/fixtures/ 2021-01-18 22:53:03 +01:00
Mislav Marohnić
c308f1cd91 Prevent further use of SetPrepareCmd and InitCmdStubber 2021-01-18 22:44:53 +01:00
Mislav Marohnić
172ea2b078 Isolate all alias commands 2020-08-11 13:57:48 +02:00
Mislav Marohnić
c00fe73d5a Isolate issue commands 2020-08-07 00:27:55 +02:00
Mislav Marohnić
82661c197e Isolate pr list command 2020-08-04 18:38:06 +02:00
Mislav Marohnić
3ac73297eb Isolate pr status command 2020-07-31 19:07:30 +02:00
Mislav Marohnić
74b191d0f7 Isolate pr view command 2020-07-31 14:19:09 +02:00
vilmibm
f3eb092d7e isolate repo fork command and tweak usage
This commit is another isolation refactor, this time for repo fork.
However, I got fed up with the --remote="true|false|prompt" style of
flags and took this opportunity to switch to a set of bool flags:

--remote and --clone
--no-remote and --no-clone

the string args were really non standard and confusing; with only two
bools it was impossible to tell when to prompt.
2020-07-27 13:04:31 -05:00
vilmibm
c34054bdc8 isolate repo create command 2020-07-24 12:26:27 -05:00
vilmibm
05419e46f0 put gist fixture file into gist package 2020-07-22 10:36:12 -05:00
vilmibm
168bd33bc9 pr command scriptability improvements
This commit improves behavior and error handling for pr commands when
run unattached to a tty.

- error if pr create and no -t/-f
- error if pr create and -w
- machine readable pr list
- machine readable pr view
- various cleanup of informational messages
2020-07-20 13:04:17 -05:00
Mislav Marohnić
13b9c98b2b Match named queries in test stubs 2020-07-10 20:04:54 +02:00
Corey Johnson
be5fc07928
Merge pull request #899 from cli/merge-interactive-merge
Interactive merge
2020-05-26 08:33:47 -07:00
Nate Smith
9ebeb5fa91
Merge pull request #981 from cli/gist-create
gh gist create
2020-05-25 14:51:32 -05:00
Mislav Marohnić
fb63efcf05 Avoid crash around "DISMISSED" or "PENDING" reviewer states 2020-05-20 14:59:40 +02:00
vilmibm
ed1a3a60fd Merge remote-tracking branch 'origin/master' into wingkwong/master 2020-05-13 13:43:09 -05:00
Corey Johnson
f0cd830170 Fix merge flag
Co-Authored-By: Nate Smith <vilmibm@neongrid.space>
2020-05-12 09:22:37 -07:00
Nate Smith
5ba3baa3c8
Merge pull request #762 from doi-t/reviewers-in-pr-view
Add Reviewers to pr view in CLI
2020-05-08 14:46:08 -05:00
Mislav Marohnić
93c61a83b2 Fix pr status -R crash with closed PR on the default branch
At the time we have a reference to `baseRepo`, we might still not have
contacted the API nor obtained any information about the default branch
for the repository. This expands the `PullRequests()` query to always
report the default branch so we may choose how to render entries that
belong on the current branch.
2020-05-07 20:53:03 +02:00
Toshiya Doi
d2d0b47ecc Merge branch 'master' into reviewers-in-pr-view 2020-04-30 00:31:04 +09:00
rista404
a2a6036c65
Add tests 2020-04-25 23:12:51 +02:00
Toshiya Doi
1ce09ff758 Merge branch 'master' into reviewers-in-pr-view 2020-04-22 22:00:02 +09:00
Toshiya Doi
67907c8b00 Support ghost reviews in pr view 2020-04-22 21:59:09 +09:00
Toshiya Doi
d70358ea34 Support GitHub Team in requested reviewers 2020-04-22 21:58:01 +09:00
Nate Smith
c670049ce7
Merge pull request #745 from doi-t/add-metadata-to-view
Add relevant metadata to issue view in CLI
2020-04-09 16:27:07 -05:00
Toshiya Doi
2df5281f2f Merge branch 'master' into reviewers-in-pr-view 2020-04-10 04:46:05 +09:00
Toshiya Doi
6223a2c198 Puts completed reviews before review requests and sort reviewer names alphabetically 2020-04-10 01:16:43 +09:00
Toshiya Doi
6d0e5bf2b8 Remove Participants related codes for pr view` 2020-04-10 01:02:51 +09:00
Toshiya Doi
054ec3c635 Remove Participants related codes 2020-04-10 00:56:45 +09:00
Toshiya Doi
531bfbc295 Update unit tests for PR metadata 2020-04-08 20:07:19 +09:00
Toshiya Doi
cef525a0a2 Update unit tests for PR metadata 2020-04-08 16:27:10 +09:00
Toshiya Doi
9169c8d0eb Update unit tests for issue metadata 2020-04-08 14:48:08 +09:00
Toshiya Doi
85d8f808f2 Test pr metadata in CLI preview 2020-04-04 13:14:34 +09:00
Toshiya Doi
1279131f0f Simplify issue struct avoiding to sue edges 2020-04-04 11:28:52 +09:00
Toshiya Doi
8c697a0d99 Test issue metadata in CLI preview 2020-04-04 11:28:52 +09:00