fix(helm): preserve block scalar semantics#4541
Conversation
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
✅ Deploy Preview for zarf-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
|
@brandtkeller Did you find the PR or dependency update that changed this behavior? |
#4194 introduced an additional marshal into the |
|
Could you add a test for this? E2E or unit if you can make that work |
|
What do you think of using kyaml "sigs.k8s.io/kustomize/kyaml/yaml" here instead. I tested it out and it seems to solve this problem in a cleaner way. Though I have not run the full e2e test suite with it https://kubernetes.io/docs/reference/encodings/kyaml/ |
I'll get a test written to serve as a baseline and then look at swapping that dependency - I should have put this in draft as it was end-of-day and not complete (mainly wanted CI). |
|
Great! I rescind my recommendation to switch to "sigs.k8s.io/kustomize/kyaml/yaml", I was conflating kustomize yaml with kyaml. The latter seems to be more of a tool for printing clearly rather than marshalling and unmarshalling |
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Composed the logic into a new private function to make it easier to test (initial and regression). You can see the test fail or pass based on the existence of re-adding the newline. I don't see any changes in behavior across yaml parsers but do largely believe that this is a combination of the newline being stripped prior to unmarshall/marshall. I see kyaml as an example of having similarly implemented a check for re-adding the newline. |
AustinAbro321
left a comment
There was a problem hiding this comment.
Nice tests, help me understand what block scalers are
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com> Signed-off-by: Tim Seagren <timseagren@defenseunicorns.com>
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com> Signed-off-by: Austin Abro <austinabro321@gmail.com>
Description
v0.63.0 introduced new behaviors to the post-render process for helm charts whereby:
This change ensures we preserve the trailing newline.
Related Issue
Fixes #4537
Checklist before merging