From cf5be9a6161085a92f60d5345b15e8d394d69f0f Mon Sep 17 00:00:00 2001 From: Lance Ball Date: Thu, 21 Jul 2022 17:52:20 -0400 Subject: [PATCH] fix: stop build progress loop when build completes (#1133) This change prevents the incremental build messages that loop while building from continuing during subsequent deploy phases by providing a cancelable context to the `printBuildActivity()` function parameters. Fixes: https://github.com/knative-sandbox/kn-plugin-func/issues/974 Signed-off-by: Lance Ball --- client.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client.go b/client.go index 3303743e8..a1f2a11a0 100644 --- a/client.go +++ b/client.go @@ -608,7 +608,8 @@ func ensureRuntimeDir(f Function) error { // not contain a populated Image. func (c *Client) Build(ctx context.Context, path string) (err error) { c.progressListener.Increment("Building function image") - + ctx, cancel := context.WithCancel(ctx) + defer cancel() // If not logging verbosely, the ongoing progress of the build will not // be streaming to stdout, and the lack of activity has been seen to cause // users to prematurely exit due to the sluggishness of pulling large images