background
I prepare a manifest file of Kubernetes, build a docker image from circleci in GitOps operation, push it to ECR, and at the same time, send PR of image tag change from circleci to GitHub
At that time, I tried to edit the manifest file in the circleci job as well
Problems, unknown points
I tried to change the yaml file using yq command.
yq -y -i '.images |= map(select(.name=="XXXXXXXXXXXX.dkr.ecr.ap-northeast-1.amazonaws.com/backend-admin").newTag |= '$CIRCLE_SHA1')' k8s/overlays/dev/bases/kustomization.yaml
manifest file
namespace: production
bases:
- ../../../bases/admin
patchesStrategicMerge:
- patch-admin.yaml
images:
- name: nginx
newTag: 1.15.2
- name: XXXXXXXXXXXX.dkr.ecr.ap-northeast-1.amazonaws.com/backend
newName: XXXXXXXXXXXX.dkr.ecr.ap-northeast-1.amazonaws.com/backend
newTag: backend-tag
- name: XXXXXXXXXXXX.dkr.ecr.ap-northeast-1.amazonaws.com/frontend
newName: XXXXXXXXXXXX.dkr.ecr.ap-northeast-1.amazonaws.com/frontend
newTag: latest
but error occur
jq: error: a99cce09747507feb74799e1e1c9459aba43d4a6/0 is not defined at <top-level>, line 1:
.images |= map(select(.name=="XXXXXXXXXXXX.dkr.ecr.ap-northeast-1.amazonaws.com/backend-admin").newTag |= a99cce09747507feb74799e1e1c9459aba43d4a6)
I think that the cause is that it is included up to I saw various articles, but none of them led to a solution.
I want to know if anyone knows something