Add support for custom template paths to template store #790
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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
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
Checklist:
git commit -s