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 <patrickzheng@microsoft.com>
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
@codecov-commenter
Copy link

codecov-commenter commented Oct 27, 2023

Codecov Report

Attention: Patch coverage is 59.18367% with 20 lines in your changes missing coverage. Please review.

Project coverage is 64.05%. Comparing base (31c9e84) to head (cd7e69d).
Report is 136 commits behind head on main.

Files with missing lines Patch % Lines
cmd/notation/verify.go 40.00% 7 Missing and 2 partials ⚠️
cmd/notation/manifest.go 0.00% 6 Missing and 1 partial ⚠️
cmd/notation/registry.go 0.00% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@            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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
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 <patrickzheng@microsoft.com>
Two-Hearts added a commit to Two-Hearts/notation that referenced this pull request Nov 3, 2023
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
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 <patrickzheng@microsoft.com>
shizhMSFT pushed a commit that referenced this pull request Nov 3, 2023
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
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 <patrickzheng@microsoft.com>
shizhMSFT pushed a commit that referenced this pull request Nov 3, 2023
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
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 <patrickzheng@microsoft.com>
@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
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
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 <patrickzheng@microsoft.com>
rgnote pushed a commit to rgnote/notation that referenced this pull request Mar 8, 2024
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
Signed-off-by: rgnote <5878554+rgnote@users.noreply.github.com>
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 <patrickzheng@microsoft.com>
Signed-off-by: rgnote <5878554+rgnote@users.noreply.github.com>
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