faas-cli icon indicating copy to clipboard operation
faas-cli copied to clipboard

use template store pull in build for fetching the configured template before default templates

Open NikhilSharmaWe opened this issue 2 years ago • 10 comments

Description

This PR makes the faas-cli fetch the template specified in the config yaml of a function before pulling the default templates from https://github.com/openfaas/templates.git.

Motivation and Context

  • [x] I have raised an issue to propose this change (required) Fixes: #927

How Has This Been Tested?

Demo: https://asciinema.org/a/5caWeeVN1fDHWZ8gNqU6GADi5

Types of changes

  • [x] 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)

Checklist:

  • [x] My code follows the code style of this project.
  • [ ] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.
  • [x] I've read the CONTRIBUTION guide
  • [x] I have signed-off my commits with git commit -s
  • [ ] I have added tests to cover my changes.
  • [x] All new and existing tests passed.

NikhilSharmaWe avatar Jun 01 '23 05:06 NikhilSharmaWe

@alexellis PTAL

NikhilSharmaWe avatar Jun 01 '23 05:06 NikhilSharmaWe

Hi @NikhilSharmaWe will do. Could you format your commit message please?

https://cbea.ms/git-commit/

alexellis avatar Jun 01 '23 12:06 alexellis

It's not what I was asking for, but this behaviour may be better.

We also need to handle the case where someone's set up the configuration section in the YAML file to specify which templates to download.

See the note here: https://github.com/openfaas/faas-cli/issues/927#issuecomment-1570286374

That section needs to be considered.

This works because golang-middleware is in the template store to - but a custom template may not be in the store - therefore, you'd have the URL in the config section.. and the CLI would need to iterate / check there and download those templates (if required).

alexellis avatar Jun 01 '23 12:06 alexellis

@alexellis In this : https://github.com/openfaas/faas-cli/issues/927#issuecomment-1570286374, you are using

config:
  templates:
  - name: golang-middleware

instead of

configuration:
  templates:
  - name: golang-middleware

Here I try it out with no source and with a custom source, and it works. PTAL: https://asciinema.org/a/OWfpfF1AQe39tgB1km5zu1tX3

Please give your thoughts.

NikhilSharmaWe avatar Jun 01 '23 14:06 NikhilSharmaWe

Interesting... I wonder whether that was the issue all along - that it worked, but I was giving the wrong name for the section in the YAML.

But I also like the idea of looking at the store for any templates that are not found in a local directory.

alexellis avatar Jun 02 '23 08:06 alexellis

@alexellis Please inform me if just in case something else needs to be added here.

NikhilSharmaWe avatar Jun 02 '23 12:06 NikhilSharmaWe

We need to have several people play with this, and ideally draw up a truth table of how the command works in different scenarios.

No templates locally, no config section, named function not in store No templates locally, no config section, named function in store No templates locally, config section present, named function in store

This is at least 3x3 configurations to evaluate.

alexellis avatar Jun 02 '23 13:06 alexellis

@alexellis Any updates regarding this? Something need to be done here?

NikhilSharmaWe avatar Jun 09 '23 10:06 NikhilSharmaWe

@alexellis PTAL at my previous comment.

NikhilSharmaWe avatar Jun 20 '23 12:06 NikhilSharmaWe

I left a comment, I'm not sure if you've seen it yet? https://github.com/openfaas/faas-cli/pull/965#issuecomment-1573744649

alexellis avatar Jul 26 '23 08:07 alexellis