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

feat: make vals able to eval dictionaries #530

Merged
merged 2 commits into from
Nov 1, 2024

Conversation

thomasbecker
Copy link
Contributor

We've some use cases where we have plain dictionaries in yaml files and need to evaluate secret refs with vals. We've a workaround/hack to use yq to change this dictionaries into a format that vals likes and then back to it's origin after secrets are evaluated. But this is kinda hacky, thus this PR.

The yq hack (don't mind the extra quotings/escapes as this is part of a larger script):

 yq ". as \$in | {\"data\": \$in} | .data = (eval(.) | .data)" "$file" | vals eval | yq eval ".data" > "${file}.tmp" && mv "${file}.tmp" "$file"

Signed-off-by: Thomas Becker <thomas.becker00@gmail.com>
Signed-off-by: Thomas Becker <thomas.becker00@gmail.com>
@thomasbecker thomasbecker force-pushed the feat/handle-dictionaries branch from ae4c7f6 to 6ef4b48 Compare September 24, 2024 08:30
@yxxhero
Copy link
Member

yxxhero commented Sep 30, 2024

@mumoshu WDYT?

@thomasbecker
Copy link
Contributor Author

Any update on this one? It won't break anything and make vals work for plain dicts as well.

Copy link
Collaborator

@mumoshu mumoshu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you very much for your contribution @thomasbecker!

@mumoshu mumoshu merged commit c6d5af5 into helmfile:main Nov 1, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants