build: use long running context for client

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
pull/37/head
Tonis Tiigi 6 years ago
parent 38889013af
commit e7eac2b909

@ -285,7 +285,7 @@ func isDefaultMobyDriver(d driver.Driver) bool {
func toSolveOpt(d driver.Driver, multiDriver bool, opt Options, dl dockerLoadCallback) (solveOpt *client.SolveOpt, release func(), err error) { func toSolveOpt(d driver.Driver, multiDriver bool, opt Options, dl dockerLoadCallback) (solveOpt *client.SolveOpt, release func(), err error) {
defers := make([]func(), 0, 2) defers := make([]func(), 0, 2)
release = func() { releaseF := func() {
for _, f := range defers { for _, f := range defers {
f() f()
} }
@ -293,7 +293,7 @@ func toSolveOpt(d driver.Driver, multiDriver bool, opt Options, dl dockerLoadCal
defer func() { defer func() {
if err != nil { if err != nil {
release() releaseF()
} }
}() }()
@ -466,7 +466,7 @@ func toSolveOpt(d driver.Driver, multiDriver bool, opt Options, dl dockerLoadCal
} }
so.FrontendAttrs["add-hosts"] = extraHosts so.FrontendAttrs["add-hosts"] = extraHosts
return &so, release, nil return &so, releaseF, nil
} }
func Build(ctx context.Context, drivers []DriverInfo, opt map[string]Options, docker DockerAPI, auth Auth, pw progress.Writer) (resp map[string]*client.SolveResponse, err error) { func Build(ctx context.Context, drivers []DriverInfo, opt map[string]Options, docker DockerAPI, auth Auth, pw progress.Writer) (resp map[string]*client.SolveResponse, err error) {

@ -72,7 +72,7 @@ func Boot(ctx context.Context, d Driver, pw progress.Writer) (*client.Client, er
} }
} }
c, err := d.Client(ctx) c, err := d.Client(context.TODO())
if err != nil { if err != nil {
if errors.Cause(err) == ErrNotRunning && try <= 2 { if errors.Cause(err) == ErrNotRunning && try <= 2 {
continue continue

Loading…
Cancel
Save