Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can i use nesting values ? #16

Open
polRk opened this issue Dec 6, 2019 · 4 comments
Open

How can i use nesting values ? #16

polRk opened this issue Dec 6, 2019 · 4 comments
Labels
question Further information is requested

Comments

@polRk
Copy link

polRk commented Dec 6, 2019

image:
  registry: 
  repository: 
  tag: latest
  pullSecret: regcred

It doesn't work


      - name: Deploy to DigitalOcean Kubernetes
        uses: 'deliverybot/helm@v1.4.0'
        with:
          release: ''
          version: '${{ github.sha }}'
          namespace: 'default'
          chart: './helm'
          helm: helm3
          values: 
            image: 
              tag: "${{ github.sha }}"
        env:
          KUBECONFIG_FILE: $GITHUB_WORKSPACE/.kubeconfig

@colinjfw
Copy link
Collaborator

@polRk what error are you seeing when you try this?

@colinjfw colinjfw added the question Further information is requested label Dec 16, 2019
@riker09
Copy link
Contributor

riker09 commented Jun 5, 2020

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?

@winggundamth
Copy link

winggundamth commented Apr 29, 2021

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?

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

@riker09
Copy link
Contributor

riker09 commented Apr 30, 2021

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants