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 <lball@redhat.com>
This commit is contained in:
Lance Ball 2022-07-21 17:52:20 -04:00 committed by GitHub
parent ff20f53671
commit cf5be9a616
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -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