【发布时间】:2022-12-02 05:27:43
【问题描述】:
So basically, I have this command that runs in Gitlab CI to update a field in YAML configuration before packaging and pushing a Helm chart.
yq -i -y ".pod.image.imageTag="${CI_COMMIT_SHORT_SHA}"" deployment/values.yaml
values.yaml
pod:
image:
repository: my.private.repo/my-project
imageTag: 'latest'
nodegroupName: "nessie-nodegroup"
But I keep getting this error.
jq: error: syntax error, unexpected IDENT, expecting $end (Unix shell quoting issues?)
.pod.image.imageTag=4c0118bf
The variable is actually read but it looks like I'm doing something wrong in the yq command. Any ideas where that error is coming from ? Trying with only one quote doesn't read the environment variable obviously. I already tried it.
Update:
Trying with :
yq -i -y '.pod.image.imageTag="${CI_COMMIT_SHORT_SHA}"' deployment/values.yaml
and
yq -i -y .pod.image.imageTag="${CI_COMMIT_SHORT_SHA}" deployment/values.yaml
didn't work either.
【问题讨论】: