Function Templates don't get properly updated when using --overwrite
Expected Behaviour
When using the --overwrite flag on faas-cli template pull file deletions should be propagated into the local template directory.
Current Behaviour
When using the --overwrite flag on faas-cli template pull file deletions are ignored, only new or updated files are updated in the local template directory.
Possible Solution
https://github.com/openfaas/faas-cli/blob/c9d284d0c5bd90415baf9130fdce55af8e5a506b/commands/fetch_templates.go#L110
Rather than copy the files, delete the directory, and re-copy the entire directory, e.g.
os.RemoveAll("./templates/myTemplate")
os.MkdirAll("./templates/myTemplate", FileMode)
Steps to Reproduce (for bugs)
- Create a template git repo
- Add files to function directory in repo
faas-cli pull <repo>- Delete a file from function directory in repo
faas-cli pull <repo> --overwrite-> File delete isn't propagated
Context
Whilst building a new template lots of changes can happen so pulling the template is a regular thing to do.
Obviously also the --overwrite is useful for new versions of the template too.
Your Environment
- FaaS-CLI version ( Full output from:
faas-cli version):
CLI:
commit: c12d57c39ac4cc6eef3c9bba2fb45113d882432f
version: 0.12.14
-
Docker version ( Full output from:
docker version): N/A -
Are you using Docker Swarm (FaaS-swarm ) or Kubernetes (FaaS-netes)? N/A
-
Operating System and version (e.g. Linux, Windows, MacOS): MacOS 11
-
Link to your project or a code example to reproduce issue: N/A