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

Add support for custom template paths to template store #790

Closed
wants to merge 2 commits into from

Conversation

justinfx
Copy link

@justinfx justinfx commented Apr 7, 2020

To support hosting templates within the directory structure of an existing project, we need to allow for custom paths to the root template directory instead of requiring a separate repo with a root level template directory.

Signed-off-by: Justin Israel [email protected]

Description

This pull request implements most of the feature requested in #789 by allowing a template store to define templates that exist in a path of the repo other than "./template". The purpose of this feature is to support templates in existing/mixed projects where the repo is not solely a template store.

Changes include:
The template store pull / list / describe commands, allowing a template store to consider an optional "path" to use instead of "./template" at the root of the repo.

The stack yaml support is updated to also accept a "path" string field in addition to the "name" and "source" of a template.

The template pull command is also updated to allow an optional path arg after the repository.

faas-cli template pull \
    'https://gitlab.company.com/group/project#branch' \
    path/to/template

Motivation and Context

I have an existing project providing tools and multi-language clients. Part of this project wants to provide integration with openfaas, and it makes sense to host the templates within this project. But it does not make sense to store them in a generically named "template" root directory; it belongs in a nested path relevant to the faas support. Allowing template stores to support an optional root template path makes the template store support more flexible in not requiring a standalone template store repository.

Fixes #789

  • I have raised an issue to propose this change (required)

How Has This Been Tested?

I have added relevant unit tests to excercise a nested template path. And I have practically tested this feature against my own template store in a nested path of a larger project.

My test environment involves just running the standard go unit tests locally.

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)

Checklist:

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

…s#789)

To support hosting templates within the directory structure of an existing project, we need to allow for custom paths to the root template directory instead of requiring a separate repo with a root level template directory.

Signed-off-by: Justin Israel <[email protected]>
@derek derek bot added the new-contributor label Apr 7, 2020
@alexellis
Copy link
Member

Hi thanks for your interest in OpenFaaS.

I'm sorry that you worked on a PR without waiting for approval for it. This is contrary to the community spirit, and creates a false sense of pressure to accept the change without discussion or allowing the maintainers to look into the request.

See notes here:

https://github.com/openfaas/faas/blob/master/CONTRIBUTING.md#i-have-a-great-idea

Please do not raise a proposal after doing the work - this is counter to the spirit of the project. It is hard to be objective about something which has already been done

@justinfx
Copy link
Author

I saw the guideline about raising the proposal first, to prevent a situation where I might do work that gets declined as a PR. But I needed this anyways for my site solution and would have ended up using the feature in a fork, regardless of its official status. So I submitted the work I did as a prototype for the proposal, since it was done.
No pressure to accept this, coming from me.

@alexellis alexellis closed this Dec 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Req] Template store to allow custom sub-directory path to "template"
2 participants