-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
The gateway currently supports returning results that contain a single ref or a map of refs. The map is used for multi-platform results.
buildkit/frontend/gateway/client/result.go
Lines 12 to 17 in f3b968c
| type Result struct { | |
| mu sync.Mutex | |
| Ref Reference | |
| Refs map[string]Reference | |
| Metadata map[string][]byte | |
| } |
I'm proposing the change the return type to an array instead. So it will either be an array of refs or a map of array of refs. Obviously, an array can have a single item that is the current behavior. The Solve function itself continues to return a single result.
The main change is that all the exporters would need to handle the case where an array of refs is passed to them. In the image based workers that would mean that all refs are converted to blobs and stacked on top of each other in the image config.
This provides extra caching capabilities where parts of the build for a single image are completely isolated, so the change in the parent layers does not invalidate the cache for later ones.
When used together with #870 this enables the possibility to do 2nd day ops (rebasing an image) without even pulling down neither the base image nor the updated image(if that matches existing cache).
I know I already changed the return type once when map was added resulting a weird struct and extra detection code for older versions but think this would still be a good update and worth it.