Add `include` template function for partials
What does this MR do?
The built-in template
action of text/template
package returns
a value of type map[string]any
. Its output can not be treated as
string or piped into string valued functions, such as indent
.
This change introduces include
template function, like Helm. It
executes partial templates and return the result as a string value.
Usage:
{{ include "name" pipeline }}
This function does not allow recursive calls, i.e. including a partial template within itself. It expects a non-nil pipeline as its input context.
Author's Checklist
For anything in this list which will not be completed, please provide a reason in the MR discussion.
Required
-
Ensure a release milestone is set. -
MR title and description are up to date, accurate, and descriptive. -
MR targeting the appropriate branch. -
MR has a green pipeline on GitLab.com. -
When ready for review, MR is labeled workflowready for review per the MR workflow.
Expected
-
Test plan indicating conditions for success has been posted and passes. -
Documentation is created or updated. -
Tests are added.
Related issues
Closes #19 (closed)
Edited by Hossein Pursultani