-
Notifications
You must be signed in to change notification settings - Fork 85
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
feat: add inspect blob commands #888
base: main
Are you sure you want to change the base?
feat: add inspect blob commands #888
Conversation
1ffee89
to
3b75784
Compare
Also as per spec we have a new field called |
665c5f8
to
53d25cf
Compare
53d25cf
to
3272be7
Compare
3272be7
to
9788c7a
Compare
Signed-off-by: Rishab Semlani <rrsemlani@gmail.com>
Signed-off-by: Rishab Semlani <rrsemlani@gmail.com>
Signed-off-by: Rishab Semlani <rrsemlani@gmail.com>
Signed-off-by: Rishab Semlani <rrsemlani@gmail.com>
Signed-off-by: Rishab Semlani <rrsemlani@gmail.com>
9788c7a
to
7e8dbe0
Compare
Signed-off-by: Rishab Semlani <rrsemlani@gmail.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #888 +/- ##
==========================================
+ Coverage 64.93% 71.05% +6.12%
==========================================
Files 45 49 +4
Lines 2729 2246 -483
==========================================
- Hits 1772 1596 -176
+ Misses 795 453 -342
- Partials 162 197 +35 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Rishab Semlani <rrsemlani@gmail.com>
Signed-off-by: Rishab Semlani <rrsemlani@gmail.com>
Signed-off-by: Rishab Semlani <rrsemlani@gmail.com>
Signed-off-by: Rishab Semlani <rrsemlani@gmail.com>
Signed-off-by: Rishab Semlani <rrsemlani@gmail.com>
Signed-off-by: Rishab Semlani <rrsemlani@gmail.com>
Signed-off-by: Rishab Semlani <rrsemlani@gmail.com>
Signed-off-by: Rishab Semlani <rrsemlani@gmail.com>
Signed-off-by: Rishab Semlani <rrsemlani@gmail.com>
Signed-off-by: Rishab Semlani <rrsemlani@gmail.com>
"os" | ||
) | ||
|
||
func ReadFile(path string, size int64) ([]byte, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function should be moved into internal/osutil/file.go
.
And all public methods (including the ones inside internal
) should have a function doc. For this function, that would start with // ReadFile ...
} | ||
} | ||
|
||
func Signatures(mediaType string, digest string, output InspectOutput, sigFile []byte) (error, []SignatureOutput) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, function doc is missing. Basically, what does this function do? What are the inputs? What are the outputs?
} | ||
} | ||
|
||
func Signatures(mediaType string, digest string, output InspectOutput, sigFile []byte) (error, []SignatureOutput) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is called Signatures
and returning an array of SignatureOutput
, so it seems to be processing multiple signatures. However, from its input sigFile []byte
and logic sigEnvelope, err := signature.ParseEnvelope(mediaType, sigFile)
, it actually can only process one signature per call. Please make sure this is by design.
skippedSignatures := false | ||
if err != nil { | ||
logSkippedSignature(digest, err) | ||
skippedSignatures = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you are return nil, nil
right after this line, toggling this local bool seems redundant?
|
||
certListNode := sigNode.Add("certificates") | ||
for _, cert := range signature.Certificates { | ||
certNode := certListNode.AddPair("SHA256 fingerprint", cert.SHA256Fingerprint) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a use case that the user would like to have an array of SHA256 fingerprints, starting from the leaf cert to the root cert, in the output. For example, if the SHA256 fingerprints for leaf is aaaaa
, for intermediate 1 is bbbbb
, for intermediate 2 is ccccc
, and for root is ddddd
. Then when I run notation blob inspect my_sig
, I could get an array ["aaaaa", "bbbbb", "ccccc", "ddddd"]
from the final output.
The current implementation does not support it, where I have to copy/paste/assemble such an array myself. Can we add a new field to the output to show the array?
/cc: @yizha1 @FeynmanZhou
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add corresponding E2E test cases for blob inspect
command under test/e2e
.
Adding inspect blob commands.
Spec Pr used for ref: #811