I am looking for some help with using "yq" to replace / add existing array elements by name. Also conditionally? Appreciate your help in this regard.
I have tried the below so far.. but this just merges and I am getting duplicates when I rerun this after updates.
yq eval-all '... comments="" | . as $item ireduce ({}; . *+ $item)' kong-oauth.yaml kong-apikey.yaml
Following scenario, I like to updated "Master.yaml" 'services' array only by name.
Master.yaml
services:
- name: service1
url: https://service1.microservice.net
- name: service2
url: https://service2.microservice.net
service3.yaml
services:
- name: service3
url: https://service3.microservice.net
service2.yaml
services:
- name: service2
url: https://service22.microservice.net
Expected YAML
services:
- name: service1
url: https://service1.microservice.net
- name: service2
url: https://service22.microservice.net
- name: service3
url: https://service3.microservice.net
Thanks Sanjay