[transformer / replacer] text/template interfering with expected result #1243
Replies: 3 comments 7 replies
-
Hi @sdurrheimer, Thanks for the detailed issue, because what you highlight here seems to be a design issue introduced by #195 and #242. Updatecli leverage Go template at two different moments in time:
Reverting #195 would be a huge breaking change which I am not ready to do. I am open to suggestion I can add an command flag such as We could add a new pipeline settings named
I probably need a bit of time to explore other possibilities |
Beta Was this translation helpful? Give feedback.
-
A potential workaround would be to chain transformer rule such as
I know It's a bit ugly, my initial idea was to do something like
But |
Beta Was this translation helpful? Give feedback.
-
I have been thinking to this problem and while providing a different replacer than '{{' would be easy, my real question is more where should we provide that customization... manifest If specified via the manifest then it would only be apply after the initial templating as we need to generate and parse the manifest first... command line If specified via the command paramenter such as |
Beta Was this translation helpful? Give feedback.
-
Hi there,
Is there a way to make
updatecli
not trying evaluate the go template functions in atransformer / replacer
?Like replace with the raw string, don't try to
text/template
it.I'm trying to sync a file from one repo to another during release, and as the destination is a helm chart, I wanted to use a
transformer / replacer
to change one line into a some go template code meant to be used by the helm chart later.With the following config,
updatecli
will try to evaluate theinclude
function, when I just want it to replace with this exact string:Code:
Result:
But If I try to escape the
{{
and}}
, theinclude
function is no more called, but the escape characters appear in the end result:{{"{{"}}- include "rancher-janitor-operator-crds.labels" . | nindent 4 {{"}}"}}
{{`"{{- include "rancher-janitor-operator-crds.labels" . | nindent 4 }}"`}}
All end up with the following, similar to the previous one, error:
If I escape more, the error moves to the next step:
{{`{{"{{\"{{\"}}"}}`}}- include "rancher-janitor-operator-crds.labels" . | nindent 4 {{`{{"{{\"}}\"}}"}}`}}
And now adding more escape options is becoming difficult
One more escape level, almost there but not good enough:
{{`{{"{{\"{{\\\"{{\\\"}}\"}}"}}`}}- include "rancher-janitor-operator-crds.labels" . | nindent 4 {{`{{"{{\"{{\\\"}}\\\"}}\"}}"}}`}}
error:
Beta Was this translation helpful? Give feedback.
All reactions