Reputation: 667
im having the following code which works on yq 3 and when I try to upgrade to yq4 it fails
this works on yq3
yq w -i dep.yaml 'spec.spec.image' $(MY_VAL)
on yq4 I got error that it doenst know w
how can I make it works
I didn't find any match example which can help to my case
https://mikefarah.gitbook.io/yq/upgrading-from-v3
Upvotes: 1
Views: 657
Reputation: 2200
Take a look at the section 'Updating / writing documents' of the migration guide.
The following command should work for your task with version 4 of yq:
dep.yaml
before execution
a:
b: 1
spec:
spec:
image: image_old.jpg
c:
d: 2
MY_VAL="image_new.jpg" yq -i e '.spec.spec.image = strenv(MY_VAL)' dep.yaml
dep.yaml
after execution
a:
b: 1
spec:
spec:
image: image_new.jpg
c:
d: 2
Upvotes: 2