Replies: 1 comment
-
I'm finding it hard to understand what you are trying to do exactly; not sure why you're using a temp file. I'd suggest using the env variable operators instead of bash "$" based substitution, as that messes with new lines, and you need lots of escaping :) Can you update the app.yaml format to be valid multiline yaml so I can try to recreate? |
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
I am trying to update one certificate inside an argo cd app project. While I am doing so it is not preserving the YAML format and making changes.
First I am fetching only the values part from the file and store in tmp-app.yaml
yq '.spec.source.helm.values' app.yaml > tmp-app.yaml
Then update the certificate value in tmp-app.yaml from a variable
yq ".oidc.caPEM |= (from_yaml | \"${ca_cert_content//$'\n'/\\n}\" | to_yaml)" -i tmp-app.yaml
Then I am loading the updated file back into the original file.
yq '.spec.source.helm.values = load("tmp-app.yaml")' -i app.yaml
Now I am facing issue in step 2 and 3.
Issues:
In step 2 all the blank lines are getting pruned and yq in increasing the indent as well.
In step 3 when i load the file it is removing (|-) from values.
My app.yaml format:
apiVersion: argoproj.io/v1alpha1 kind: Application metadata: spec: source: values: |- oidc: caPEM: |
app.yaml after update:
apiVersion: argoproj.io/v1alpha1 kind: Application metadata: spec: source: values: oidc: caPEM: |
I want to preserver '|-' after values and also any new line present under values.
Beta Was this translation helpful? Give feedback.
All reactions