Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve error messages of notation CLI #810

Merged
merged 22 commits into from
Nov 3, 2023

Conversation

Two-Hearts
Copy link
Contributor

@Two-Hearts Two-Hearts commented Oct 27, 2023

This PR improves error messages of notation sign, notation verify, notation list, and notation inspect commands. The changes include:

$ notation sign
Error: missing reference to the artifact: use `notation sign--help` to see what parameters are required

$ notation sign net-monitor:v1
Error: "net-monitor:v1": invalid reference: missing repository. Expecting <registry>/<repository>:<tag> or <registry>/<repository>@<digest>

$ notation sign test localhost:5000/net-monitor:v1
Error: "test": invalid reference: missing repository. Expecting <registry>/<repository>:<tag> or <registry>/<repository>@<digest>

$ notation sign localhost:5001/net-monitor
Error: "localhost:5001/net-monitor": invalid reference: no tag or digest. Expecting <registry>/<repository>:<tag> or <registry>/<repository>@<digest>

$ notation sign localhost:5001/net-monitor:
Error: "localhost:5001/net-monitor:": invalid reference: no tag or digest. Expecting <registry>/<repository>:<tag> or <registry>/<repository>@<digest>

$ notation sign 'localhost:5001/net-monitor:()'
Error: "localhost:5001/net-monitor:()": invalid reference: invalid tag. Expecting <registry>/<repository>:<tag> or <registry>/<repository>@<digest>

$ notation sign localhost:5001/net-monitor@
Error: "localhost:5001/net-monitor@": invalid reference: no tag or digest. Expecting <registry>/<repository>:<tag> or <registry>/<repository>@<digest>

$ notation sign localhost:5001/net-monitor@invalid
Error: "localhost:5001/net-monitor@invalid": invalid reference: invalid digest; invalid checksum digest format. Expecting <registry>/<repository>:<tag> or <registry>/<repository>@<digest>

$ notation sign --oci-layout
Error: missing reference to the artifact: use `notation sign --help` to see what parameters are required

$ notation sign --oci-layout net-monitor
Error: "net-monitor": invalid reference: missing tag or digest. Expecting <file_path>:<tag> or <file_path>@<digest>

$ notation sign --oci-layout net-monitor:
Error: "net-monitor:": invalid reference: missing tag or digest. Expecting <file_path>:<tag> or <file_path>@<digest>

$ notation sign --oci-layout net-monitor@
Error: "net-monitor@": invalid reference: missing tag or digest. Expecting <file_path>:<tag> or <file_path>@<digest>

$ notation sign --oci-layout :v1
Error: ":v1": invalid reference: missing oci-layout file path. Expecting <file_path>:<tag> or <file_path>@<digest>

$ notation sign --oci-layout '@sha256:abc'
Error: "@sha256:abc": invalid reference: missing oci-layout file path. Expecting <file_path>:<tag> or <file_path>@<digest>

$ notation verify
Error: missing reference to the artifact: use `notation verify --help` to see what parameters are required

$ notation verify net-monitor:v1
Error: "net-monitor:v1": invalid reference: missing repository. Expecting <registry>/<repository>:<tag> or <registry>/<repository>@<digest>

$ notation verify test localhost:5000/net-monitor:v1
Error: "test": invalid reference: missing repository. Expecting <registry>/<repository>:<tag> or <registry>/<repository>@<digest>

$ notation verify localhost:5001/net-monitor
Error: "localhost:5001/net-monitor": invalid reference: no tag or digest. Expecting <registry>/<repository>:<tag> or <registry>/<repository>@<digest>

$ notation verify localhost:5001/net-monitor:
Error: "localhost:5001/net-monitor:": invalid reference: no tag or digest. Expecting <registry>/<repository>:<tag> or <registry>/<repository>@<digest>

$ notation verify 'localhost:5001/net-monitor:()'
Error: "localhost:5001/net-monitor:()": invalid reference: invalid tag. Expecting <registry>/<repository>:<tag> or <registry>/<repository>@<digest>

$ notation verify localhost:5001/net-monitor@
Error: "localhost:5001/net-monitor@": invalid reference: no tag or digest. Expecting <registry>/<repository>:<tag> or <registry>/<repository>@<digest>

$ notation verify localhost:5001/net-monitor@invalid
Error: "localhost:5001/net-monitor@invalid": invalid reference: invalid digest; invalid checksum digest format. Expecting <registry>/<repository>:<tag> or <registry>/<repository>@<digest>

$ notation verify testReg/testRepo@sha256:abcd
Error: the trust store "myStore" of type "ca" does not exist. Use command 'notation cert add' to create and add trusted certificates to the trust store

$ notation verify testReg/testRepo@sha256:abcd
Error: no x509 certificates were found in trust store "myStore" of type "ca". Use command 'notation cert add' to create and add trusted certificates to the trust store

$ notation verify testReg/testRepo@sha256:abcd
Error: failed to access the trust store "myStore" of type "ca". open /home/user/.config/notation/truststore/x509/ca/myStore: permission denied

# Same pattern applies to notation list command
$ notation list ....

# Same pattern applies to notation inspect command
$ notation inspect ....

Note, this PR depends on notaryproject/notation-go#345. (On the notation CLI side, we are not displaying any individual signature error, only corresponding error messages are updated.)

notaryproject/notation-go#345 has been merged. Notation CLI dependencies are up to date.

Resolves #699
Resolves #700
Resolves #701
Resolves #808

Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
@codecov-commenter
Copy link

codecov-commenter commented Oct 27, 2023

Codecov Report

Merging #810 (cd7e69d) into main (31c9e84) will decrease coverage by 0.05%.
The diff coverage is 59.18%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@            Coverage Diff             @@
##             main     #810      +/-   ##
==========================================
- Coverage   64.09%   64.05%   -0.05%     
==========================================
  Files          40       40              
  Lines        2284     2323      +39     
==========================================
+ Hits         1464     1488      +24     
- Misses        698      709      +11     
- Partials      122      126       +4     
Files Coverage Δ
cmd/notation/inspect.go 68.63% <100.00%> (ø)
cmd/notation/list.go 77.47% <100.00%> (+4.65%) ⬆️
cmd/notation/sign.go 79.38% <100.00%> (ø)
cmd/notation/registry.go 61.05% <0.00%> (-2.00%) ⬇️
cmd/notation/manifest.go 54.83% <0.00%> (-1.83%) ⬇️
cmd/notation/verify.go 80.95% <40.00%> (-4.77%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

go.mod Outdated Show resolved Hide resolved
JeyJeyGao
JeyJeyGao previously approved these changes Nov 2, 2023
Copy link
Contributor

@JeyJeyGao JeyJeyGao left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@JeyJeyGao JeyJeyGao left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@priteshbandi priteshbandi left a comment

Choose a reason for hiding this comment

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

LGTM

@Two-Hearts Two-Hearts merged commit bb2669b into notaryproject:main Nov 3, 2023
5 checks passed
@Two-Hearts Two-Hearts deleted the errMsg branch November 3, 2023 00:30
priteshbandi pushed a commit that referenced this pull request Nov 3, 2023
Bumping up to notation-go v1.0.1.
As #810 is merged, bumping
up build is successful now.

---------

Signed-off-by: Patrick Zheng <[email protected]>
Two-Hearts added a commit to Two-Hearts/notation that referenced this pull request Nov 3, 2023
Two-Hearts added a commit to Two-Hearts/notation that referenced this pull request Nov 3, 2023
Bumping up to notation-go v1.0.1.
As notaryproject#810 is merged, bumping
up build is successful now.

---------

Signed-off-by: Patrick Zheng <[email protected]>
shizhMSFT pushed a commit that referenced this pull request Nov 3, 2023
shizhMSFT pushed a commit that referenced this pull request Nov 3, 2023
Bumping up to notation-go v1.0.1.
As #810 is merged, bumping
up build is successful now.

---------

Signed-off-by: Patrick Zheng <[email protected]>
shizhMSFT pushed a commit that referenced this pull request Nov 3, 2023
shizhMSFT pushed a commit that referenced this pull request Nov 3, 2023
Bumping up to notation-go v1.0.1.
As #810 is merged, bumping
up build is successful now.

---------

Signed-off-by: Patrick Zheng <[email protected]>
@shizhMSFT shizhMSFT mentioned this pull request Nov 6, 2023
6 tasks
rgnote pushed a commit to rgnote/notation that referenced this pull request Mar 8, 2024
rgnote pushed a commit to rgnote/notation that referenced this pull request Mar 8, 2024
Bumping up to notation-go v1.0.1.
As notaryproject#810 is merged, bumping
up build is successful now.

---------

Signed-off-by: Patrick Zheng <[email protected]>
rgnote pushed a commit to rgnote/notation that referenced this pull request Mar 8, 2024
rgnote pushed a commit to rgnote/notation that referenced this pull request Mar 8, 2024
Bumping up to notation-go v1.0.1.
As notaryproject#810 is merged, bumping
up build is successful now.

---------

Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: rgnote <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants