rich-helicopter-7653
07/30/2024, 5:22 PMgarden deploy
?microscopic-river-74022
07/30/2024, 5:22 PMmicroscopic-river-74022
07/30/2024, 5:23 PMgarden deploy
by using the exec
plugin and defining an initScript
in your project configuration. This script will be run in the project root when initializing providers. Here's an example:
yaml
# In your project level Garden config file
apiVersion: garden.io/v1
kind: Project
name: my-project
providers:
- name: exec
initScript: "sh -c ./scripts/auth.sh"
- name: kubernetes
dependencies: [exec] # <--- This ensures the init script runs before the K8s plugin is initialized.
# ...
In this example, a script auth.sh
is run to authenticate against a Kubernetes cluster before initializing the Kubernetes plugin. The exec
plugin is built-in, so you don't need to specify it in your project configuration. You can simply add exec
actions right away.
You can also define custom commands as part of your Garden project. These custom commands can be run before the Garden command starts. Here's an example:
yaml
kind: Command
name: api-dev
description:
short: Start garden with preconfigured options for API development
exec:
command:
- sh
- -c
- git submodule update --recursive --remote # Because we keep forgetting to update these, amirite?
gardenCommand:
- deploy
- --sync
- api,worker
- --log-level
- debug
- $concat: ${args.$all} # Allow any arguments/options on top of the fixed ones above
In this example, before the Garden command starts, the submodules in the repo are updated, and then garden deploy
is started with some parameters.microscopic-river-74022
07/30/2024, 5:23 PM