Browse code

builder: do not cancel buildkit status request

This fixes a bug when the build results in an error and instead of sending
the logs of the container to the client, it signals a cancelation.

The context should not be wired to the status request, as only the
build requests need to be canceled.

Signed-off-by: Tibor Vass <tibor@docker.com>

Tibor Vass authored on 2018/08/07 06:39:56
Showing 1 changed files
... ...
@@ -258,9 +258,10 @@ func (b *Builder) Build(ctx context.Context, opt backend.BuildConfig) (*builder.
258 258
 
259 259
 	eg.Go(func() error {
260 260
 		defer close(ch)
261
-		return b.controller.Status(&controlapi.StatusRequest{
262
-			Ref: id,
263
-		}, &statusProxy{streamProxy: streamProxy{ctx: ctx}, ch: ch})
261
+		// streamProxy.ctx is not set to ctx because when request is cancelled,
262
+		// only the build request has to be cancelled, not the status request.
263
+		stream := &statusProxy{streamProxy: streamProxy{ctx: context.TODO()}, ch: ch}
264
+		return b.controller.Status(&controlapi.StatusRequest{Ref: id}, stream)
264 265
 	})
265 266
 
266 267
 	eg.Go(func() error {