history api: support for logs of completed builds#3339
history api: support for logs of completed builds#3339tonistiigi merged 11 commits intomoby:masterfrom
Conversation
b45a3a9 to
f427054
Compare
602e785 to
dbfbbcd
Compare
e557e2e to
f7ddfe1
Compare
| if req.NoWait { | ||
| return nil | ||
| } |
There was a problem hiding this comment.
I see OpenBlobWriter has been introduced to save tracing. Is the purpose of NoWait to avoid waiting for the history to be loaded in case it's being deleted/gc?
There was a problem hiding this comment.
NoWait is if the client only wants to get a list of builds once and keep waiting on updates for them. Currently, the only use case is in the tests where because some tests check for cleaned contentstore the full build history also needs to be cleaned.
There was a problem hiding this comment.
Could we rename it to Exit or EarlyExit or similar?
| if s := trace.SpanFromContext(ctx); s.SpanContext().IsValid() { | ||
| if exp, err := detect.Exporter(); err == nil { | ||
| if rec, ok := exp.(*detect.TraceRecorder); ok { | ||
| stopTrace = rec.Record(s.SpanContext().TraceID()) |
There was a problem hiding this comment.
We are gathering spans for the build and save them to the history now. TraceID() is used to be sure we capture the right traces for the build right?
There was a problem hiding this comment.
We filter out the tracing info only for the same traceID that was set in the tracing context of the solve function. So two solves get their own individual traces.
0f91453 to
c61c8e6
Compare
| if req.NoWait { | ||
| return nil | ||
| } |
There was a problem hiding this comment.
Could we rename it to Exit or EarlyExit or similar?
|
Will there be something on |
c61c8e6 to
fceddbd
Compare
|
0717a26 to
d1129c3
Compare
|
CI is red 👀 |
d1129c3 to
2c3fe26
Compare
jedevc
left a comment
There was a problem hiding this comment.
Provenance refactor looks good to me, few minor comments, but happy for this to merge once CI is green and comments are fixed.
| if err != nil { | ||
| return nil, err | ||
| } | ||
| func (s *Solver) recordBuildHistory(ctx context.Context, id string, req frontend.SolveRequest, j *solver.Job) (func(*Result, exporter.DescriptorReference, error) error, error) { |
There was a problem hiding this comment.
We should have a tracking issue for SBOM support with build history if we're not doing it in this PR.
93d336e to
bbb57ea
Compare
ce8e671 to
661b2df
Compare
|
|
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
661b2df to
ab0d1a6
Compare
|
@tonistiigi Thank you for notifying me. Is it an expected bahavior of this PR that BuildKit (with containerd worker configuration) doesn't cleanup containerd content store when pruning the cache all?
# mkdir -p /tmp/ctx-a && cat <<EOF > /tmp/ctx-a/Dockerfile
FROM ubuntu:22.04
EOF
# buildctl build --progress=plain --frontend=dockerfile.v0 \
--local context=/tmp/ctx-a --local dockerfile=/tmp/ctx-a \
--output type=oci,dest=/tmp/test.tar
# buildctl prune --all
# buildctl du
ID RECLAIMABLE SIZE LAST ACCESSED
Reclaimable: 0B
Total: 0B
# ctr --namespace=buildkit content ls
DIGEST SIZE AGE LABELS
sha256:0585b60588963c4c76ac974991ddb8943760ea70c9e781b4d43ec023856dd37d 3.613kB 5 seconds -
sha256:59329cca1b6c70654247470c3039b0076f3cffdc9ab32cce2f1006f404ab5642 481B 6 seconds containerd.io/gc.ref.content.0=sha256:f35120b15f00b87e24dcf48439e45507e56802b121a7c8ebf7f1ddafe69d88e6,containerd.io/gc.ref.content.1=sha256:6e3729cf69e0ce2de9e779575a1fec8b7fb5efdfa822829290ab6d5d1bc3e797
sha256:5e44ffe94256b613961a33356a6710f668e01e66ffd00000f535b10b92c6bac0 3.585kB 5 seconds -
sha256:6e3729cf69e0ce2de9e779575a1fec8b7fb5efdfa822829290ab6d5d1bc3e797 30.43MB 5 seconds buildkit.io/blob/annotation.containerd.io/uncompressed=sha256:6515074984c6f8bb1b8a9962c8fb5f310fc85e70b04c88442a3939c026dbfad3,buildkit.io/blob/mediatype=application/vnd.docker.image.rootfs.diff.tar.gzip,containerd.io/gc.ref.content.blob-sha256:6e3729cf69e0ce2de9e779575a1fec8b7fb5efdfa822829290ab6d5d1bc3e797=sha256:6e3729cf69e0ce2de9e779575a1fec8b7fb5efdfa822829290ab6d5d1bc3e797
sha256:7f9e7e014d150b47278fef38fe32896eb1e73c6c43bfe6a4842ade77ede515e6 258.5kB 2 seconds -
sha256:f35120b15f00b87e24dcf48439e45507e56802b121a7c8ebf7f1ddafe69d88e6 870B 6 seconds -
|
Previously this was not issue as manifest was deleted after build completed but now the manifest is kept in build history API. Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
buildctl debug logs <refid>now also works for completed builds. The logs are kept in contentstore with a simple length-based encoding of the proto format.Signed-off-by: Tonis Tiigi tonistiigi@gmail.com