How can i use nesting values ?
image:
registry:
repository:
tag: latest
pullSecret: regcred
It doesn't work
- name: Deploy to DigitalOcean Kubernetes
uses: 'deliverybot/[email protected]'
with:
release: ''
version: '${{ github.sha }}'
namespace: 'default'
chart: './helm'
helm: helm3
values:
image:
tag: "${{ github.sha }}"
env:
KUBECONFIG_FILE: $GITHUB_WORKSPACE/.kubeconfig
@polRk what error are you seeing when you try this?
Have you tried
values: |
image.tag: "${{ github.sha }}"
When setting values for helm on the command line you'd use --set image.tag=$GITHUB_SHA, maybe the same applies here too?
Have you tried
values: | image.tag: "${{ github.sha }}"When setting values for
helmon the command line you'd use--set image.tag=$GITHUB_SHA, maybe the same applies here too?
I tried it and it is not working. fortunately, I found the way by putting it in JSON format instead of YAML.
values: |
{
"image": {
"tag": "${{ github.sha }}"
}
}
But it will be better if we can it to support YAML nested format.
This is my guest. The root cause of the problem comes from when you using this
values: |
image:
tag: "${{ github.sha }}"
It will remove space indent on the second line, so content in values.yml will look like this
image:
tag: "abcdefg"
See my debug value to test this scenario here https://github.com/winggundamth/bookinfo-ratings/runs/2468832416. You will see the following to confirm my assumption that the space indent has been removed
Run deliverybot/helm@v1
with:
helm: helm3
release: bookinfo-dev-ratings
namespace: student169-bookinfo-dev
chart: k8s/helm
value-files: k8s/helm-values/values-bookinfo-dev-ratings.yaml
values: extraEnv:
COMMIT_SHA: de44bcca7d9a046fc3a625cbbc1006b949408b68
env:
ENV_NAME: dev
KUBECONFIG: /home/runner/work/bookinfo-ratings/bookinfo-ratings/2f4bf7f5-da00-4f07-a59e-d7f69bbeb0a2
Ah yes, the infamous multiline strings in YAML. Whenever I have to deal with this I head over to https://yaml-multiline.info/. But it looks like you are right and there is no way of keeping the indentation intact. Your solution is probably the only way to make this work. Thankfully YAML and JSON are compatible since YAML is a superset of JSON. This is explained in detail in this StackOverflow question (and answer).