Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for the --watch flag for faas-cli up #969

Merged
merged 5 commits into from
Jun 30, 2023
Merged

Fixes for the --watch flag for faas-cli up #969

merged 5 commits into from
Jun 30, 2023

Conversation

alexellis
Copy link
Member

Fixes for the --watch flag for faas-cli up due to incomplete / defective feature PR.

Description

  • Fixes issue where all functions are rebuilt even if only one changed
  • Fixes issue where unrelated files cause rebuilds
  • Fixes issue where vim can't trigger and update due to using create
  • Adds newly created folders into the watch when within a function's path
  • Triggers rebuilds via stack.yml

Motivation and Context

Fixes: #968

How Has This Been Tested?

Tested with:

  • creating a new folder within a function's handler
  • editing a function's code multiple times with vim
  • editing the stack.yml file
  • faas-cli new --append during a watch
  • two functions, only the changed one is rebuilt
  • Out of scope for this PR - "copy extra directories" that can be specified for each function

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)

@alexellis
Copy link
Member Author

* Fixes issue where all functions are rebuilt even if only
one changed
* Fixes issue where unrelated files cause rebuilds
* Fixes issue where vim can't trigger and update due to using
create
* Adds newly created folders into the watch when within a
function's path
* Triggers rebuilds via stack.yml

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
commands/up.go Outdated Show resolved Hide resolved
commands/up.go Outdated Show resolved Hide resolved
commands/up.go Show resolved Hide resolved
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
Fixes a bug where localrun was sending an empty string to the
fprocess variable for the dockerfile template. This is a problem
because the template will never define this variable, it's
set in the Dockerfile.

So whilst a manual docker run command worked, the localrun
command did not.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
@alexellis
Copy link
Member Author

I've added a note on why --watch won't work with localrun with the current design.

We need some kind of Go routine, cancellation/context approach so that the docker run which is blocking, doesn't block the watcher code - and the watcher code has a chance to kill the docker run for a prior version before starting a new build/run.

@alexellis alexellis merged commit d240045 into master Jun 30, 2023
@alexellis alexellis deleted the fix_up_watch branch June 30, 2023 11:36
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.

Issue with new feature faas-cli up --watch
2 participants