Open jessesuen opened 2 hours ago
Adding a note here that, as we discussed offline, I think it's important to preserve formatting and field order. (We took great care to do so with YAML.) If we don't it creates noise in the diffs.
Fortunately, I think this is accomplished somewhat easily with this lib: https://github.com/tidwall/sjson
Proposed Feature
We just introduced the
yaml-update
step, which is a great improvement overhelm-update-image
. Now we should add an equivalentjson-update
step to deal withjson
files.Motivation
This would enable users who use other config management tools like .jsonnet or grafana tanka. Somone using jsonnet could patch an image tag to a
.json
. Technically they could even patch a.jsonnet
file, as long as that file was pure json and did not use any jsonnet syntax.Suggested Implementation
Step syntax can follow the same syntax as
yaml-update
but understand how to manipulate a JSON file.As a future improvement, we could consider leaving room for different patching types (JSON Patch, JSON Merge Patch), but I would not consider this required for MVP. Also, I do not think we should support strategic merge patch, which is a can of worms I would not want to go down.