Skip to content

Commit

Permalink
solver: always respect value of evaluate field
Browse files Browse the repository at this point in the history
Always use the value of the evaluate field to force result generation,
which previously was not performed for frontends. This improves API
consistency, and ensures the value is used regardless of whether
the solver uses a frontend, or a raw definition.

Signed-off-by: Justin Chadwell <[email protected]>
  • Loading branch information
jedevc committed Oct 12, 2022
1 parent 10a334f commit d709afd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions solver/llbsolver/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,6 @@ func (b *llbBridge) Solve(ctx context.Context, req frontend.SolveRequest, sid st

if req.Definition != nil && req.Definition.Def != nil {
res = &frontend.Result{Ref: newResultProxy(b, req)}
if req.Evaluate {
_, err = res.Ref.Result(ctx)
}
} else if req.Frontend != "" {
f, ok := b.frontends[req.Frontend]
if !ok {
Expand All @@ -157,6 +154,12 @@ func (b *llbBridge) Solve(ctx context.Context, req frontend.SolveRequest, sid st
} else {
return &frontend.Result{}, nil
}
if req.Evaluate {
err = res.EachRef(func(ref solver.ResultProxy) error {
_, err := res.Ref.Result(ctx)
return err
})
}

if len(res.Refs) > 0 {
for p := range res.Refs {
Expand Down

0 comments on commit d709afd

Please sign in to comment.