You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a problem with the underlying yaml parser yq uses (go/yaml), which makes a best effort approach in round-tripping comments. There have been several issues raised against that project; but none have been addressed :(
I also have a similar problem when trying to update a tag inside a values.yaml.gompl where there was something like this:
privateRegistry: {{ requiredEnv "PRIVATE_REGISTRY" }}
After running the yq command, it returns: privateRegistry: {? {requiredEnv "PRIVATE_REGISTRY": ''}: ''}
Is there a workaround for this?
@mikefarah Is there a ticket for go/yaml I could vote for? This is quite limiting for processing human-edited YAMLs... If you could please link one, thanks
yq
messes with the comments when just reading and then writing (edit: due to a bug in the underlying go/yaml).Version of yq: 4.40.05
Operating system: linux, Ubuntu 23.10
Input Yaml
Original:
After any processing by yq:
Notice the difference: The
### }
is moved down 2 lines.My guess is that based on the position,
yq
determines correctly it is afoot_comment
.But because of indentation,
yq
determines it as belonging to the node at the same level - the nest array element, starting at- name
.And then mixes it together, and puts it to that node (let's call it
.images[1].name
) as afoot_comment
.Correct behavior would be, despite it's indentation, assign that as belonging to
.images[0].newTag
, even if with a misfitting indentation.Command
More less any command that retains the affected nodes.
Thanks for reviewing.
The text was updated successfully, but these errors were encountered: