Adding Sprig for mutating outputs -> vars #1364
Replies: 2 comments
-
Thanks for the pointer to sprig! We most definitely want to have stronger templating features so that transforming outputs is easier. |
Beta Was this translation helpful? Give feedback.
-
We are just embarking on adding a proposal process to Porter. The first step is discussing the idea in our forums (I've moved the issue into the forum). There is an existing issue that discusses the idea of adding functions to our templates, but there has been no traction. For context, we currently use cbroglie/mustache for templating. So a proposal would need to take that into consideration, since it looks like sprig uses go templates. We'd want to understand if it would be a breaking change, or if another library would work well. One concern that the mentioned issue gets into is how to use templating without creating invalid yaml, and still allow the expression of non-string values. So that would be useful to keep in mind as well. I'm not asking that you write up a PEP, though if you'd like to that would be incredibly helpful. 😉 Just leaving info here for whoever would like to tackle this. |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
Sometimes an output needs to be manipulated for an input to another mixin invocation.
Say a bundle has two mixin invocations.
The first one has an output that’s a list of IPs.
The second one needs a single IP address as an input.
Using sprig we could split the IP list on comma and take the first IP.
{{ bundle.outputs.ip_list | splitList “,” | first }}
Describe the solution you'd like
Including the sprig library to provide more template functions.
Beta Was this translation helpful? Give feedback.
All reactions