Replies: 1 comment 1 reply
-
I would probably just use env variables for the bash bit; and then use the load operator to embed another yaml file in:
Explanation:
Use |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a yaml array kinda like so
y1.yaml
I have another file like so
y2.yaml
What I need to do is create a new "record" (i.e. array element) in
y1.yaml
from a bash heredoc (below) and then addy2.yaml
under a newdetails:
key of that new record/element saving it all back toy1.yaml
.so result would look like this.
y1.yaml
I saw a lot of hard coded examples of insert (including docs) but nothing that uses another yaml file or a string of yaml (as a heredoc).
When using sed I single quote out and in anything I want bash to subs/eval in the sed 'command' so maybe something like that except yq expects json there not yaml.
maybe kinda like this???
yq e '<prejson>' $(yq -o=json '.' y2.yml)' <closing json> * .' y1.yml
#1688
https://stackoverflow.com/questions/61109518/how-to-insert-or-add-a-field-in-a-yaml-after-a-specific-key-in-yq
#821
Little Help/ Suggestions? Thx
Beta Was this translation helpful? Give feedback.
All reactions