build: don't set add-hosts option if empty

This looks like an oversight, all of the other options have similar
checks. This can interfere with generated provenance where "add-hosts"
will be marked as an argument to the build, even though it's not
actually being utilized.

Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
Justin Chadwell 2022-12-07 19:15:58 +00:00
parent d1f79317cf
commit 98049e7eda
1 changed files with 3 additions and 1 deletions

View File

@ -607,7 +607,9 @@ func toSolveOpt(ctx context.Context, node builder.Node, multiDriver bool, opt Op
if err != nil {
return nil, nil, err
}
so.FrontendAttrs["add-hosts"] = extraHosts
if len(extraHosts) > 0 {
so.FrontendAttrs["add-hosts"] = extraHosts
}
// setup shm size
if opt.ShmSize.Value() > 0 {