Fix support for multiple --tla-code arguments #574
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While running the
tk apply
command with multiple--tla-code
arguments, each containing akey='value'
parameter, I noticed that the JSONNET code would not receive them correctly. More specifically, instead of being passed as named parameters, they are passed as positional parameters and since they're stored in ajsonnet.InjectedCode
map, they end up being serialised in an arbitrary order which differs each time Tanka is run. I added a test in this PR which highlights this issue (you might need to run it multiple times to get a failure).Note that this issue only surfaces when using multiple
--tla-code
args when callingtk apply
.I am rather new to this tool, so I'm not fully aware of all the ways in which people use the
--tla-code
argument. Please let me know if I missed any other edge cases.