-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Log ensureArtifact ConflictErr #19294
Conversation
Friendly nudge for review : ) |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #19294 +/- ##
=======================================
Coverage ? 67.56%
=======================================
Files ? 991
Lines ? 109172
Branches ? 2720
=======================================
Hits ? 73757
Misses ? 31449
Partials ? 3966
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@@ -227,6 +227,7 @@ func (c *controller) ensureArtifact(ctx context.Context, repository, digest stri | |||
if !errors.IsConflictErr(err) { | |||
return false, nil, err | |||
} | |||
log.Debugf("failed to create artifact %d: %v", art.ID, 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.
The var art
is assigned in the first line of this function, it should be nil if the artifact is not found, so here print art.ID
may cause the panic.
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.
Thanks for the catch! I also added a test case in the unit test for this code path.
Gentle nudge for review. Thanks! |
Ping for review. Thanks |
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
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
Signed-off-by: Shuaiyi Liu <[email protected]>
Signed-off-by: Shuaiyi Liu <[email protected]>
* Log ensureArtifact ConflictErr Signed-off-by: Shuaiyi Liu <[email protected]> * Log ensureArtifact ConflictErr Signed-off-by: Shuaiyi Liu <[email protected]> --------- Signed-off-by: Shuaiyi Liu <[email protected]> Co-authored-by: Wang Yan <[email protected]> Signed-off-by: Altynbaev Dinislam <[email protected]>
Thank you for contributing to Harbor!
Comprehensive Summary of your change
https://github.com/goharbor/harbor/blob/main/src/controller/artifact/controller.go#L230
conflict error will always be overwritten here if GetByDigest returns an error, making it hard to debug the conflict error. This change logs the conflict error before it gets overwritten
Issue being fixed
Fixes #19293
Please indicate you've done the following: