little-army-47606
05/15/2024, 4:34 PMmicroscopic-river-74022
05/15/2024, 4:34 PMmicroscopic-river-74022
05/15/2024, 4:35 PMgarden.yml
configuration file.
For workflows, you can define a script step like this:
yaml
kind: Workflow
name: my-workflow
steps:
- script: |
echo "Hello there!"
Scripts in workflows can also be templated:
yaml
kind: Workflow
name: my-workflow
steps:
- script: |
echo "Hello ${project.name}!"
You can run a workflow by running garden workflow <name>
, or have it trigger automatically via Garden Cloud. For more details, refer to the Workflows section () in the Garden documentation.
For run actions, the configuration looks like this:
yaml
# garden.yml
kind: Run
name: db-migrate
type: container
build: backend
spec:
command: ["rake", "db:migrate"]
You can run a Run manually with the garden run <run-name>
command. This will run the Run regardless of whether or not the result is cached. For more details, refer to the Runs section () in the Garden documentation.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------microscopic-river-74022
05/15/2024, 4:35 PMlittle-army-47606
05/15/2024, 4:55 PMlittle-army-47606
05/15/2024, 4:55 PMmicroscopic-river-74022
05/15/2024, 4:55 PMmicroscopic-river-74022
05/15/2024, 4:56 PMexec
command in Garden. This can be done either in a running Deploy
container or as a Run
action.
To execute a shell script in a running Deploy
container, you can use the garden exec
command followed by the name of your deployment and the shell script command. This assumes that sh
is available in the container. Here's an example:
bash
garden exec my-deploy -- sh /path/to/your/script.sh
Source ()
To run a shell script as a Run
action, you can define it in your garden.yml
configuration file and then use the garden run
command to execute it. Here's an example:
yaml
kind: Run
name: my-run-action
type: container
build: backend
spec:
command: ["sh", "/path/to/your/script.sh"]
You can then run this action with:
bash
garden run my-run-action
Source ()
Please replace /path/to/your/script.sh
with the actual path to your shell script.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------microscopic-river-74022
05/15/2024, 4:56 PMlittle-army-47606
05/15/2024, 5:03 PMmicroscopic-river-74022
05/15/2024, 5:03 PMmicroscopic-river-74022
05/15/2024, 5:03 PM${git.commitHash}
template string to get the current Git commit hash. This value can be set as an environment variable in your garden.yml
configuration file. Here's an example:
yaml
kind: Module
type: container
name: my-module
services:
- name: my-service
env:
MY_VARIABLE: ${git.commitHash}
In this example, MY_VARIABLE
is an environment variable that will be set to the current Git commit hash when the service is run. Please replace my-module
and my-service
with the actual names of your module and service.
Note that the commit hash is resolved at the start of the Garden command's execution and is not updated if the current commit changes during the command's execution.
For more information, refer to the Garden documentation on template strings ().
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------microscopic-river-74022
05/15/2024, 5:03 PMlittle-army-47606
05/15/2024, 5:08 PMmicroscopic-river-74022
05/15/2024, 5:08 PMmicroscopic-river-74022
05/15/2024, 5:08 PM0.14
. It's recommended to use action-based configuration instead. For more details on migrating from modules to actions, you can refer to the 0.12 to Bonsai migration guide ().
Please note that while modules still work with Garden Bonsai, they are not documented. For module related documentation, you can refer to the Garden 0.12 documentation ().
Source 1 ()
Source 2 ()
Source 3 ()
Source 4 ()
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------microscopic-river-74022
05/15/2024, 5:08 PM