openfaas / faas-cli

Official CLI for OpenFaaS
https://www.openfaas.com/
Other
798 stars 224 forks source link

Implement --watch for local-run with cancellation support #970

Closed alexellis closed 1 year ago

alexellis commented 1 year ago

Description

Implement --watch for localrun with cancellation support

Motivation and Context

1) Implements faas-cli local-run -- watch and related to fixes in #969 which were for faas-cli up --watch 2) Implements --publish flag for up, so that up can be used with --platforms and for faster builds when iterating.

How Has This Been Tested?

This commit adds --watch support to localrun by using a context to cancel and remove any running container when a change is detected.

watchLoop has been updated to support a context.

Tested with VSCode - I suggest turning auto-save off when using this feature.

Tested again with faas-cli up to make sure there was no regression:

https://asciinema.org/a/594072

Types of changes