build: avoid panic on linking to nil target
Note that nil targets still do not work as buildkit does not currently support build inputs with nil values. But this gives cleaner error from buildkit instead of panic on the client side. Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
+6
-3
@@ -1074,9 +1074,12 @@ func waitContextDeps(ctx context.Context, index int, results *waitmap.Map, so *c
|
||||
for _, v := range contexts {
|
||||
if len(rr.Refs) > 0 {
|
||||
for platform, r := range rr.Refs {
|
||||
st, err := r.ToState()
|
||||
if err != nil {
|
||||
return err
|
||||
st := llb.Scratch()
|
||||
if r != nil {
|
||||
st, err = r.ToState()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
so.FrontendInputs[k+"::"+platform] = st
|
||||
so.FrontendAttrs[v+"::"+platform] = "input:" + k + "::" + platform
|
||||
|
||||
Reference in New Issue
Block a user