-
Notifications
You must be signed in to change notification settings - Fork 14
Add fromYAML
/toYAML
functions
#193
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
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dhaiducek The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
pkg/templates/templates.go
Outdated
newMatchStr = strings.Replace(newMatchStr, "toYaml", fmt.Sprintf("toYaml | indent %d", numSpaces), 1) | ||
newMatchStr = strings.Replace(newMatchStr, "toYAML", fmt.Sprintf("toYAML | indent %d", numSpaces), 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/hold I realized this replacement doesn't account for the toYAML
argument--I'll have to adjust it to a RegEx replacement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is resolved as a known issue and this block has been removed. Helm also notes that indentation processing can't be handled by the template processor and must be specified by the user. I'll create an issue to add hints/suggestions to error messages in this case.
// The output will not be indented, so you will want to pipe this to the
// 'indent' template function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New issue opened for error message hints: https://issues.redhat.com/browse/ACM-20011
3389297
to
11c3b61
Compare
/unhold |
ref: https://issues.redhat.com/browse/ACM-19746 Signed-off-by: Dale Haiducek <19750917+dhaiducek@users.noreply.github.com>
I found having results on a separate line made it easier to parse. Signed-off-by: Dale Haiducek <19750917+dhaiducek@users.noreply.github.com>
Some of our RegEx expressions didn't account for the `-}}` syntax Signed-off-by: Dale Haiducek <19750917+dhaiducek@users.noreply.github.com>
11c3b61
to
e762501
Compare
|
fromYAML
was straightforward, buttoYAML
brought complexities:toYAML
to the autoindent processing because it will result in a multiline string.That said, I might be okay if
toYAML
were just not available (sincetoJSON
likely works more reliably) or iftoYAML
just pointed totoJSON
, though there are cases where users might want to be able to generate YAML (like inobject-templates-raw
or in a ConfigMap).I also noticed some of our RegExs were missing the Go template whitespace chomping character
-}}
, which affected one of the tests I wrote.ref: https://issues.redhat.com/browse/ACM-19746