-
Notifications
You must be signed in to change notification settings - Fork 168
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
Create EntryID for new artifacts and return EntryID to user #623
Conversation
4613650
to
565128a
Compare
pkg/api/entries.go
Outdated
err := fmt.Errorf("error creating EntryID from active treeID and uuid %v: %v", hexEncodedHash, err) | ||
return nil, handleRekorAPIError(params, http.StatusBadRequest, err, fmt.Sprintf(validationError, err)) |
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.
err := fmt.Errorf("error creating EntryID from active treeID and uuid %v: %v", hexEncodedHash, err) | |
return nil, handleRekorAPIError(params, http.StatusBadRequest, err, fmt.Sprintf(validationError, err)) | |
err := fmt.Errorf("error creating EntryID from active treeID and uuid %v: %w", hexEncodedHash, err) | |
return nil, handleRekorAPIError(params, http.StatusInternalServerError, err, fmt.Sprintf(validationError, err)) |
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.
at this point we've already committed the change to the log... so while I expect this code path to never actually get executed, the burden wouldn't be on the client to resolve anything so we should return a 500 error.
This is correct! We should release a version of the client that supports longer versions ASAP - then release this some time later. @cpanato any idea if we can kick off another Rekor CLI release? |
Just to confirm my understanding:
|
we can cut a v0.5.0 release, I don't think we are ready for a v1.0.0 I will check the changelog and maybe we can cut that today |
+1 to v0.5! |
@dlorenc This is also my understanding. There is an e2e test right now that includes a rekor-cli GET command for the new EntryID here. |
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.
code looks good to me, once the cli is up to speed.
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.
lgtm other than minor error wrapping nit
pkg/api/entries.go
Outdated
hexEncodedHash := hex.EncodeToString(queuedLeaf.GetMerkleLeafHash()) | ||
entryID, err := sharding.CreateEntryIDWithActiveTreeID(hexEncodedHash) | ||
if err != nil { | ||
err := fmt.Errorf("error creating EntryID from active treeID and uuid %v: %v", hexEncodedHash, err) |
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.
nit if you end up re-spinning this:
err := fmt.Errorf("error creating EntryID from active treeID and uuid %v: %v", hexEncodedHash, err) | |
err := fmt.Errorf("error creating EntryID from active treeID and uuid %v: %w", hexEncodedHash, err) |
Note to self: after #671 is merged, we will have to use |
I think this will require #671 to be merged first to pass CI. |
What's the plan for merging and rolling this out? |
@dlorenc Once we merge #727 , that should take care of the last known bug. @priyawadhwa and I are double checking on anything else that needs to happen from the roadmap before merging this, but I think most/all of the outstanding work should be optional. |
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.
small nits around naming, otherwise LGTM!
@@ -223,7 +223,10 @@ func TestGet(t *testing.T) { | |||
out := runCli(t, "upload", "--artifact", artifactPath, "--signature", sigPath, "--public-key", pubPath) | |||
outputContains(t, out, "Created entry at") | |||
|
|||
uuid := getUUIDFromUploadOutput(t, out) | |||
uuid, err := sharding.GetUUIDFromIDString(getUUIDFromUploadOutput(t, out)) |
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.
should getUUIDFromUploadOutput
be renamed to getEntryIDFromUploadOutput
?
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.
Agree, though this is a larger problem all throughout the code. #625 is tracking this. Pulling on that thread will definitely create enough changes for another PR.
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.
we can save it for later then!
pkg/api/entries.go
Outdated
@@ -187,7 +187,14 @@ func createLogEntry(params entries.CreateLogEntryParams) (models.LogEntry, middl | |||
metricNewEntries.Inc() | |||
|
|||
queuedLeaf := resp.getAddResult.QueuedLeaf.Leaf | |||
uuid := hex.EncodeToString(queuedLeaf.GetMerkleLeafHash()) | |||
|
|||
hexEncodedHash := hex.EncodeToString(queuedLeaf.GetMerkleLeafHash()) |
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.
hexEncodedHash
is the same as uuid
right? might be clearer to keep the name as uuid
since entry id = tree id + uuid
39b4607
to
aff3f76
Compare
91f36ee
to
6bac6ad
Compare
Signed-off-by: Lily Sturmann <lsturman@redhat.com>
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.
lgtm
Summary
This will complete the UUID parsing component of the sharding work. It creates and returns a longer UUID (EntryID) to the user, so this change should go into a new release.
Edit:
As far as I understand, we should wait to merge this PR until we're ready for a new Rekor release - are there other changes that would go into that release? Do we have a timeline?
Ticket Link
Fixes #487
Release Note