我正在使用github操作来创建新的图像并将它们推送到注册表。
- name: Build the Docker image
run: docker build . --file Dockerfile --tag ${{secrets.DOCKER_USER}}/book:$GITHUB_SHA
这工作完美。现在,我需要替换图像的值。所以我想到用yq
apiVersion: apps/v1
kind: Deployment
spec:
template:
spec:
containers:
- image: xxxxx/book:main
- name: Replace Image
run: yq -i e '.spec.template.spec.containers.image |= ${{secrets.DOCKER_USER}}/guestbook:$GITHUB_SHA' argo/deployment.yaml
但是得到这个错误Error: 1:43: invalid input text "xxxx/book:..." Error: Process completed with exit code 1.
我该怎么做这个替换?
1条答案
按热度按时间r1zhe5dt1#
对
image
属性使用正确的json路径表达式,并在替换值上加上引号。示例: