mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-18 00:47:48 +08:00

Strongly typing the API allows us to perform all command line parsing fully on the client-side, where we have access to the client local directory and all the client environment variables, which may not be available on the remote server. Additionally, the controller api starts to look a lot like build.Options, so at some point in the future there may be an oppportunity to merge the two, which would allow both build and bake to execute through the controller, instead of needing to maintain multiple code paths. Signed-off-by: Justin Chadwell <me@jedevc.com>
22 lines
436 B
Go
22 lines
436 B
Go
package pb
|
|
|
|
import "github.com/moby/buildkit/client"
|
|
|
|
func CreateCaches(entries []*CacheOptionsEntry) []client.CacheOptionsEntry {
|
|
var outs []client.CacheOptionsEntry
|
|
if len(entries) == 0 {
|
|
return nil
|
|
}
|
|
for _, entry := range entries {
|
|
out := client.CacheOptionsEntry{
|
|
Type: entry.Type,
|
|
Attrs: map[string]string{},
|
|
}
|
|
for k, v := range entry.Attrs {
|
|
out.Attrs[k] = v
|
|
}
|
|
outs = append(outs, out)
|
|
}
|
|
return outs
|
|
}
|