build: use gateway's solve context to allow cancelling getResultAt

Signed-off-by: Justin Chadwell <me@jedevc.com>
pull/1737/head
Justin Chadwell 2 years ago
parent 3d49bbd23a
commit 2402607846

@ -920,7 +920,7 @@ func BuildWithResultHandler(ctx context.Context, nodes []builder.Node, opt map[s
} }
results.Set(resultKey(dp.driverIndex, k), res) results.Set(resultKey(dp.driverIndex, k), res)
if resultHandleFunc != nil { if resultHandleFunc != nil {
resultCtx, err := NewResultContext(cc, so, res) resultCtx, err := NewResultContext(ctx, cc, so, res)
if err == nil { if err == nil {
resultHandleFunc(dp.driverIndex, resultCtx) resultHandleFunc(dp.driverIndex, resultCtx)
} else { } else {

@ -19,8 +19,7 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
func NewResultContext(c *client.Client, solveOpt client.SolveOpt, res *gateway.Result) (*ResultContext, error) { func NewResultContext(ctx context.Context, c *client.Client, solveOpt client.SolveOpt, res *gateway.Result) (*ResultContext, error) {
ctx := context.Background()
def, err := getDefinition(ctx, res) def, err := getDefinition(ctx, res)
if err != nil { if err != nil {
return nil, err return nil, err

Loading…
Cancel
Save