-
Notifications
You must be signed in to change notification settings - Fork 509
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
history: add error details to history inspect command #2925
Conversation
For failed builds, show the source with error location and last logs for vertex that caused the error. When debug mode is on, stacktrace is printed. Signed-off-by: Tonis Tiigi <[email protected]>
Signed-off-by: Tonis Tiigi <[email protected]>
Signed-off-by: Tonis Tiigi <[email protected]>
2e05415
to
8c27b5c
Compare
Added 2 additional commits for small fixes to |
if err != nil { | ||
return errors.Wrapf(err, "failed to parse vertex digest %s", ve.Vertex.Digest) | ||
} | ||
name, logs, err := loadVertexLogs(ctx, c, rec.Ref, dgst, 16) |
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.
Could we have an env var or --verbose
flag to remove error log lines limit ? I have a use case for build summary GHA where I need full error logs.
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'd be careful about extra fields when we are missing --format
atm. If users want more logs they can run the history logs
command.
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.
It's not just raw logs but specific build error that we need for the build summary in GHA.
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.
Although maybe 16 lines are enough to understand the issue and they can just look at ci logs
commands/history/inspect.go
Outdated
if len(logs) > 0 { | ||
fmt.Fprintf(dockerCli.Out(), "\n => %s:\n", name) | ||
for _, l := range logs { | ||
fmt.Fprintln(dockerCli.Out(), l) | ||
} | ||
fmt.Fprintln(dockerCli.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.
I would need to parse the output of inspect command for build summary in GHA. Could we have a prefix like >
that we are using to print BuildKit config with inspect
#2684 and also add a Logs:
title?:
Context: /home/crazy/docker-samba
Dockerfile: Dockerfile
VCS Repository: https://github.com/crazy-max/docker-samba.git
VCS Revision: 6d24d0cc9d7e604e08a4953c9bf53e30e82c712b
Platform: linux/amd64, linux/arm/v6, linux/arm/v7, linux/arm64, linux/386, linux/ppc64le, linux/riscv64, linux/s390x
Started: 2024-12-27 15:53:44
Duration: 25.4s
Error: Unknown process "/bin/sh -c make DESTDIR=/dist install" did not complete successfully: exit code: 2
Build Steps: 45/96 (1% cached)
Dockerfile:21
--------------------
19 | COPY patches/wsdd2 /tmp/wsdd2-patches
20 | RUN patch -p1 < /tmp/wsdd2-patches/0001-fix-msghdr-initialization.patch
21 | >>> RUN make DESTDIR=/dist install
22 |
23 | FROM crazymax/alpine-s6:${ALPINE_VERSION}-${S6_VERSION}
--------------------
Logs:
> => [linux/arm/v7 wsdd2 7/7] RUN make DESTDIR=/dist install:
> cc -Wall -Wextra -g -O0 -c -o wsdd2.o wsdd2.c
> wsdd2.c: In function 'open_ep':
> wsdd2.c:305:64: warning: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Wcalloc-transposed-args]
> 305 | struct endpoint *ep = (struct endpoint *) calloc(sizeof(*ep), 1);
> | ^
> wsdd2.c:305:64: note: earlier argument should specify number of elements, later size of each element
> wsdd2.c: In function 'netlink_recv':
> wsdd2.c:555:20: error: 'struct msghdr' has no member named '__pad2'
> 555 | , .__pad2 = 0
> | ^~~~~~
> wsdd2.c:555:29: warning: excess elements in struct initializer
> 555 | , .__pad2 = 0
> | ^
> wsdd2.c:555:29: note: (near initialization for 'msg')
> make: *** [<builtin>: wsdd2.o] Error 1
Enable --debug to see stack traces for error
Print build logs: docker buildx history logs nxhbrt6cw9fws2t4xnnw4ic5h
View build in Docker Desktop: docker-desktop://dashboard/build/builder/builder0/nxhbrt6cw9fws2t4xnnw4ic5h
Signed-off-by: Tonis Tiigi <[email protected]>
For failed builds, show source with error location and last logs for vertex that caused the error. When debug mode is on, stacktrace is printed.