Skip to content
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

multiline/tabbed data manifest serialisation fix #650

Closed
wants to merge 2 commits into from

Conversation

lbajolet
Copy link

Hi,

While using tanka on a project of mine, I happened to get erroneous YAML outputs for some manifests I generated from plain text files (using importstr 'script.sh for example).

Empirically, I found that whenever the input file contained a tab character, the output would be truncated on each line (see commit 671b00e for the sample test input/output), and the resulting YAML was unusable.

While the root cause is not known, this does seem to point to the yaml.v2 library misbehaving in such a case, which seems to have been fixed on yaml.v3.

The library was already being used in the project, so I replaced it in the manifest.go file, which has indeed fixed the formatting issue.

Please let me know if I should perform some more tests or if you want me to change more things on the related code.

Lucas Bajolet added 2 commits November 29, 2021 11:07
This test is meant to justify an upcoming modification to the YAML
serialisation for Manifests.

As seen in the expected diff here, the output is scrambled when the
source manifest contains multiline strings, especially in combination
with tab characters (\t) in the input data.
This commit fixes the issue exacerbated by the test submitted in the
parent commit where the presence of a tab character in the input string
for the configmap's data caused the output to be scrambled.

While the true root cause is not entirely known (and is supposedly fixed
on v3 of the YAML library), the indentation of the output manifest
switches to 4 spaces instead of 2, and the tabs are handled properly,
making the manifest applicable on a kubernetes cluster.
@Duologic
Copy link
Member

Discussion around yaml.v{2,3} is happening here: #607 (comment)

@lbajolet
Copy link
Author

Oh, I wasn't aware of that issue, my bad; do you think I should close this PR until a decision is taken then?

@Duologic
Copy link
Member

You can keep it open, just might take a bit of time before someone can have a proper look.

@stale
Copy link

stale bot commented Jan 8, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 8, 2022
@stale stale bot closed this Mar 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants