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

Version 4.40.4 of YQ does not parse "----" input as expected #1890

Closed
pranay-harness opened this issue Dec 4, 2023 · 6 comments
Closed

Version 4.40.4 of YQ does not parse "----" input as expected #1890

pranay-harness opened this issue Dec 4, 2023 · 6 comments
Labels

Comments

@pranay-harness
Copy link

pranay-harness commented Dec 4, 2023

Describe the bug
Version 4.40.4 of YQ does not parse "----" input as expected. It was working perfectly fine with previous version of YQ.

Version of yq: 4.40.4
Operating system: linux
Installed via: binary release

Input Yaml

config1.yml:

server:
backstageSaToken:

CLI command that does not work as expected:
CONFIG_KEY="your_key" CONFIG_VALUE="----BEGIN" yq -i eval '.[$CONFIG_KEY] = env(CONFIG_VALUE)' config1.yml" config1.yml

Output:

server:
backstageSaToken:

Version of yq: 4.35.2
Operating system: linux
Installed via: binary release

config1.yml:

server:
backstageSaToken:

CLI command that works as expected:
CONFIG_KEY="your_key" CONFIG_VALUE="----BEGIN" yq -i eval '.[$CONFIG_KEY] = env(CONFIG_VALUE)' config1.yml

Output:

server: '----BEGIN'
backstageSaToken: '----BEGIN'

Additional context
The CLI command in both cases remains the same.

@mikefarah
Copy link
Owner

The env command parses the given input (and so you can give it a number/boolean/array and it will be the correct type. --- is a document separator in yaml, and that's what it is being interpreted as.

To force it to parse as a string, use strenv instead, and you'll get what you need.

@pranay-harness
Copy link
Author

So what got changed between 4.35.2 and 4.40.4? It was perfectly working fine in the previous version, was there any change from your side?

@bharatgoelharness
Copy link

bharatgoelharness commented Dec 8, 2023

@mikefarah did you got a chance to look into this?

@mikefarah
Copy link
Owner

That's a good point re version change, not sure what would have caused that. Haven't had a chance to look at it sorry - but I'll get to it.

@mikefarah
Copy link
Owner

Found the issue :) will be fixed in the next release

mikefarah added a commit that referenced this issue Dec 12, 2023
@mikefarah
Copy link
Owner

Fixed in 4.40.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants