Implement new driver-opt: default-load

This eases build driver migrations, as it allows aligning the default behavior.
See also https://docs.docker.com/build/drivers/

Signed-off-by: Niklas Gehlen <niklas@namespacelabs.com>
This commit is contained in:
Niklas Gehlen
2024-04-05 15:30:33 +02:00
parent 5c29e6e26e
commit ccc314a823
13 changed files with 118 additions and 31 deletions

View File

@ -56,6 +56,7 @@ type Driver struct {
cgroupParent string
restartPolicy container.RestartPolicy
env []string
defaultLoad bool
}
func (d *Driver) IsMobyDriver() bool {
@ -423,6 +424,7 @@ func (d *Driver) Features(ctx context.Context) map[driver.Feature]bool {
driver.DockerExporter: true,
driver.CacheExport: true,
driver.MultiPlatform: true,
driver.DefaultLoad: d.defaultLoad,
}
}

View File

@ -94,6 +94,11 @@ func (f *factory) New(ctx context.Context, cfg driver.InitConfig) (driver.Driver
if err != nil {
return nil, err
}
case k == "default-load":
d.defaultLoad, err = strconv.ParseBool(v)
if err != nil {
return nil, err
}
case strings.HasPrefix(k, "env."):
envName := strings.TrimPrefix(k, "env.")
if envName == "" {