Good evening!
I am trying to get with yq the entries looking for a boelan value inside a yml.
e.g:
yq '.applications | to_entries | .[] | select( .persistence == "true")' manifest.yml
But this does not return anything... this would be the yml where I look for:
applications:
a:
enabled: true
project: ../../../aproj
version: v1.0.1
persistence: true
b:
enabled: false
project: ../../bproj
version: v1.0.1
c:
enabled: true
project: ../../../cproj
version: v1.0.1
persistence: true
the output should be the following entries: a,c
This seems to be a duplicate of another question - but for completion:
yq '.applications[] | select(.persistence == true) | key' file.yaml
Explanation:
.applications[]
Expand all the map values in applications select(.persistence == true)
select the ones with persistence = truekey
get their keyDisclaimer: I wrote yq