Skip to content
New issue

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

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

Already on GitHub? # to your account

value-files with multiple files: JSON string of array? #19

Closed
kierenj opened this issue Jan 15, 2020 · 8 comments · Fixed by #31
Closed

value-files with multiple files: JSON string of array? #19

kierenj opened this issue Jan 15, 2020 · 8 comments · Fixed by #31

Comments

@kierenj
Copy link

kierenj commented Jan 15, 2020

I'm trying to specify multiple value files. I've tried a JSON array as a string, as suggested:

          value-files: '[
            "api/config/env-base/values.yaml",
            "api/config/env-dev/values.yaml",
            ]'

However, the process fails with an error opening a file with the name of the entire JSON string.

Would it be possible to provide an example to demonstrate how this should work?

@colinjfw
Copy link
Collaborator

@kierenj ya it's a bit tricky to pass arguments with actions, I wish it would just allow full yaml syntax and pass that along somehow to the action.

The code that does this is here: https://github.com/deliverybot/helm/blob/master/index.js#L81-L97

I believe what's happening is you have a trailing slash in the array which is causing it to be invalid JSON, if it's invalid the action just tries to interpret it as a string. If you remove the trailing slash everything should work :)

@riker09
Copy link
Contributor

riker09 commented Feb 27, 2020

This is what I'm doing:

    - uses: deliverybot/helm@v1
      with:
        helm: helm3
        release: foobar
        namespace: default
        chart: path/to/chart
        dry-run: true
        value-files: '["values.yaml", "values.production.yaml"]'

You shouldn't indent the values. If you really want to (eg. for readability) I believe this is valid YAML:

    - uses: deliverybot/helm@v1
      with:
        helm: helm3
        release: foobar
        namespace: default
        chart: path/to/chart
        dry-run: true
        value-files: >-
          [
            "values.yaml", 
            "values.production.yaml",
          ]

Here is helpful information on how to deal with strings that contain multiple new lines: https://yaml-multiline.info/

@colinjfw
Copy link
Collaborator

Thanks @riker09 - I think the trailing slash would still cause an error.

@riker09
Copy link
Contributor

riker09 commented Mar 2, 2020

What trailing slash are we talking about? I can spot a trailing comma which may cause an error.

@colinjfw
Copy link
Collaborator

colinjfw commented Mar 2, 2020

Ya my bad I actually meant comma

@riker09
Copy link
Contributor

riker09 commented Mar 2, 2020

So in conclusion a perfectly valid configuration would look like this:

    - uses: deliverybot/helm@v1
      with:
        helm: helm3
        release: foobar
        namespace: default
        chart: path/to/chart
        dry-run: true
        value-files: >-
          [
            "values.yaml", 
            "values.production.yaml"
          ]

Notice the removed comma on the second to last line.

@nodox
Copy link

nodox commented Apr 24, 2020

There should be a clear example in the README. I've spent hours trying to figure out this problem with this action.

@colinjfw
Copy link
Collaborator

colinjfw commented Jun 6, 2020

@nodox feel free to contribute an example, will be happy to merge it.

colinjfw pushed a commit that referenced this issue Jul 14, 2020
mlwelles pushed a commit to noho-digital/helm that referenced this issue Aug 19, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants