Exec (local scripts)
The exec
plugin and corresponding exec
module type allow you to run commands locally on the host (e.g. your laptop or on your CI runner).
It's built-in which means you don't need to specify it in the project level configuration and you can simply add exec
modules right away.
It's great for running auth scripts as well as executing various scaffolding scripts that need to run "locally".
It can also be used to start services locally (e.g. by executing commands like yarn dev
).
This can be very useful for hybrid environments where you have, say, your backend running in a remote production-like environment but your frontend running locally.
Plugin Configuration
Usually you don't need to configure the exec plugin because it's built-in and you can use exec modules directly.
However, it can be used to run init scripts ahead of other Garden execution. This is e.g. useful if you need to authenticate against a remote environment before Garden initializes other plugins.
Here's an example where we run a script to authenticate against a Kubernetes cluster before initializing the Kubernetes plugin:
Module Configuration
Exec tasks
Here's an example configuration for an exec module that's used for running various scripts:
Other actions can depend on these tasks:
It's also possible to reference the output from exec module tasks:
Local services
The exec module can also be used to start long running services like so:
See also this example project.
Next Steps
For some advanced exec use cases, check out this recording of our community office hours on the topic.
Last updated