Add context to registry push errors - #2981
Conversation
| err := e.pushImage(ctx, src, sessionID, targetName, desc.Digest) | ||
| if err != nil { | ||
| return nil, err | ||
| return nil, fmt.Errorf("failed to push %v: %w", targetName, err) |
There was a problem hiding this comment.
We don't allow fmt.Errorf in build repos because they lose stacktraces. Use pkg/errors.Wrap
There was a problem hiding this comment.
Good to know, thanks!
There was a problem hiding this comment.
Does it lose stack traces even with %w?
There was a problem hiding this comment.
Yes. Stdlib errors does not capture a stacktrace.
There was a problem hiding this comment.
Ah, makes sense. I misunderstood your comment and thought you meant it would remove existing stack traces from the error chain.
| st = status.FromProto(pb) | ||
| } | ||
|
|
||
| if err.Error() != st.Message() { |
There was a problem hiding this comment.
Could you add a comment in here that "If grpc error was wrapped with additional message then set full message to grpc error".
Otherwise it is quite tricky to understand why this code is in here.
Signed-off-by: Jonny Stoten <jonny.stoten@docker.com>
Signed-off-by: Jonny Stoten <jonny.stoten@docker.com>
Signed-off-by: Jonny Stoten <jonny.stoten@docker.com>
67e52c2 to
df0c9b6
Compare
hack: mount docker config on gha
Fixes #2019.
Registry push error from buildx before this change:
and after: