Unexpected content added to yaml file #1907
-
I'm trying to update the opentelemetry-demo.yaml file with yq, which includes multiple documents. Specifically, I'd like to add the following environment variable to each container:
I tried using the following command for this:
That works fine for documents in the file that include
But it's also adding
How do I ensure that the new environment variable is only added to documents that already include |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Just add a It'll be something like:
You can put boolean expression in select to check for length and other things too - similar to this example here: https://mikefarah.gitbook.io/yq/recipes#find-and-update-items-in-an-array |
Beta Was this translation helpful? Give feedback.
Just add a
select
first to only select documents that you want updated.It'll be something like:
You can put boolean expression in select to check for length and other things too - similar to this example here: https://mikefarah.gitbook.io/yq/recipes#find-and-update-items-in-an-array