moby / buildkit

concurrent, cache-efficient, and Dockerfile-agnostic builder toolkit
https://github.com/moby/moby/issues/34227
Apache License 2.0
8.08k stars 1.14k forks source link

Move error to separate struct in history API #5088

Closed tonistiigi closed 3 months ago

tonistiigi commented 3 months ago

The history API record contains a nice typed error atm https://github.com/moby/buildkit/blob/v0.14.1/api/services/control/control.proto#L201 retaining information like the stacktraces, source/vertex mapping etc. The problem is that for some errors this structure can grow quite large, eg. source mapping contains the full Dockerfile source so if (in an extreme case) you have 1MB Dockerfile, this error will also be bigger than 1MB . API requests like listing history will need to transfer all these structures and encode/decode them.

Instead, the current error field should become only a short error with the main message and optionally some additional limited information. The full error should still be kept but should be moved to a separate blob in the contentstore as it is done with logs, traces, provenance attestations etc. If client needs a full error they can pull it with a separate request.