How can I have one action in Garden produce a valu...
# 🤖|ask-kapa
g
@microscopic-river-74022 How can I have one action in Garden produce a values file, and then a Helm deploy action use that values file?
m
Please stand by @glamorous-kangaroo-20427 as I search the knowledge base. I normally take about 15 seconds or so. :wave:
---------------------- In Garden, you can use the
spec.valueFiles
field in the Helm Deploy action to specify value files to use when rendering the Helm chart. These files should be specified in ascending order of precedence, with the last file in the list having the highest precedence. The paths should be relative to the config root, and the files should be contained in the action config's directory. Here's an example of how you can specify value files in a Helm Deploy action:
Copy code
yaml
kind: Deploy
type: helm
name: helm-deploy
...
spec:
  valueFiles:
    - values.default.yaml
    - values.${environment.name}.yaml
If you also specify keys under the
values
field, those will effectively be added as another file at the end of this list, so they will take precedence over other files listed here. To produce a values file from another action, you can use a Run action that generates the values file as part of its execution. You can then use the
actions.<kind>.<name>.outputs.
template keys to pass information between actions. For example, you can pass log outputs from one task to another:
Copy code
yaml
kind: Run
type: exec
name: prep-run
spec:
  command: [echo, "my run output"]
---
kind: Deploy
name: my-deploy
dependencies: [run.prep-run]
spec:
  env:
    PREP_TASK_OUTPUT: ${actions.run.prep-run.outputs.log}  # <- resolves to "my task output"
In this example, the output from
prep-run
is copied to an environment variable for
my-deploy
. Note that you currently need to explicitly declare
prep-run
as a dependency for this to work.
For more details, please refer to the Garden documentation () and the Garden action type reference docs (). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
message has been deleted
2 Views