white-kite-45517
01/16/2025, 7:54 PMmicroscopic-river-74022
01/16/2025, 7:54 PMmicroscopic-river-74022
01/16/2025, 7:54 PMyaml
kind: Build
type: exec
name: my-build
spec:
command: [echo, "my build output"]
---
kind: Deploy
name: my-deploy
dependencies: [build.my-build]
spec:
env:
BUILD_OUTPUT: ${actions.build.my-build.outputs.log}
In this example, the output from the build action is made available as an environment variable in the deploy action.
It's important to note that you need to explicitly declare the build action as a dependency for the deploy action for this to work.
For more detailed information, you can refer to the [Action Runtime outputs]() section in the Garden documentation.
[Reference > Action-types > Build > exec Build > Outputs]()
Remember, it's a good practice to make your build outputs machine-readable so they can be easily parsed by dependent actions.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------microscopic-river-74022
01/16/2025, 7:54 PMwhite-kite-45517
01/16/2025, 8:01 PMwhite-kite-45517
01/16/2025, 8:01 PMwhite-kite-45517
01/16/2025, 9:38 PMmicroscopic-river-74022
01/16/2025, 9:38 PMmicroscopic-river-74022
01/16/2025, 9:38 PMoutputs
feature of the exec action. Here's how you can do it:
1. In your exec action (which could be a Build, Run, Test, or Deploy action), you can capture the command output.
2. The output is automatically stored in predefined variables, which you can then reference in other actions or parts of your configuration.
3. The available output variables are:
- `${actions...outputs.log}`: The full log output
- `${actions...outputs.stdout}`: The stdout log output
- `${actions...outputs.stderr}`: The stderr log output
Here's an example of how you might use this in a configuration:
yaml
kind: Run
type: exec
name: my-run
spec:
command: [echo, "Hello, Garden!"]
---
kind: Deploy
name: my-deploy
dependencies: [run.my-run]
spec:
env:
MY_CUSTOM_VAR: ${actions.run.my-run.outputs.stdout}
In this example, the output from the my-run
action is captured in the MY_CUSTOM_VAR
environment variable of the my-deploy
action.
It's important to note a few things:
1. You need to explicitly declare the action that produces the output as a dependency.
2. These output variables are resolved later than other template strings, so they can't be used for fields that need to be resolved early, such as most identifiers.
3. It's a good practice to make your command outputs machine-readable for easy parsing by dependent actions.
For more detailed information, you can refer to the [Action Runtime outputs]() section in the Garden documentation.
[Reference > Action-types > Run > exec Run > Outputs]()microscopic-river-74022
01/16/2025, 9:38 PMmicroscopic-river-74022
01/16/2025, 9:38 PM