Skip to content

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

Merged
alexellis merged 5 commits into
masterfrom
localrun-watch
Jun 30, 2023
Merged

Implement --watch for local-run with cancellation support#970
alexellis merged 5 commits into
masterfrom
localrun-watch

Conversation

@alexellis

@alexellis alexellis commented Jun 30, 2023

Copy link
Copy Markdown
Member

Description

Implement --watch for localrun with cancellation support

Motivation and Context

  1. Implements faas-cli local-run -- watch and related to fixes in Fixes for the --watch flag for faas-cli up #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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

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

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This change moves the reload message to where it can be seen
instead of having it printed out mid-flow during the up
sequence.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
Publish and deploy is quicker than build push and deploy
because it doesn't run two commands and doesn't put data into
the local library first.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
@alexellis
alexellis merged commit a927085 into master Jun 30, 2023
@alexellis alexellis changed the title Implement --watch for localrun with cancellation support Implement --watch for local-run with cancellation support Jun 30, 2023
@alexellis
alexellis deleted the localrun-watch branch June 30, 2023 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant