Below is a list of Garden CLI commands and usage information.
The commands should be run in a Garden project, and are always scoped to that project.
Note: You can get a list of commands in the CLI by running garden -h/--help, and detailed help for each command using garden <command> -h/--help
The Outputs sections show the output structure when running the command with --output yaml. The same structure is used when --output json is used and when querying through the REST API, but in JSON format.
Global options
The following option flags can be used with any of the CLI commands:
Argument
Alias
Type
Description
garden build
Build your modules.
Builds all or specified modules, taking into account build dependency order. Optionally stays running and automatically builds modules if their source (or their dependencies' sources) change.
Examples:
garden build # build all modules in the project
garden build my-module # only build my-module
garden build --force # force rebuild of modules
garden build --watch # watch for changes to code
Usage
garden build [modules] [options]
Arguments
Options
Outputs
# A map of all modules that were built (or builds scheduled/attempted for) and information about the builds.builds:<module name>:# The full log from the build.buildLog:# Set to true if the build was fetched from a remote registry.fetched:# Set to true if the build was performed, false if it was already built, or fetched from a registryfresh:# Additional information, specific to the provider.details:# Set to true if the build was not attempted, e.g. if a dependency build failed.aborted:# The duration of the build in msec, if applicable.durationMsec:# Whether the build was succeessful.success:# An error message, if the build failed.error:# The version of the module, service, task or test.version:# A map of all services that were deployed (or deployment scheduled/attempted for) and the service status.deployments:<service name>:# When the service was first deployed by the provider.createdAt:# Additional detail, specific to the provider.detail:# Whether the service was deployed with dev mode enabled.devMode:# Whether the service was deployed with local mode enabled.localMode:namespaceStatuses: - pluginName:# Valid RFC1035/RFC1123 (DNS) label (may contain lowercase letters, numbers and dashes, must start with a# letter, and cannot end with a dash) and must not be longer than 63 characters.namespaceName:state:# The ID used for the service by the provider (if not the same as the service name).externalId:# The provider version of the deployed service (if different from the Garden module version.externalVersion:# A list of ports that can be forwarded to from the Garden agent by the provider.forwardablePorts: - # A descriptive name for the port. Should correspond to user-configured ports where applicable.name:# The preferred local port to use for forwarding.preferredLocalPort:# The protocol of the port.protocol:# The target name/hostname to forward to (defaults to the service name).targetName:# The target port on the service.targetPort:# The protocol to use for URLs pointing at the port. This can be any valid URI protocol.urlProtocol:# List of currently deployed ingress endpoints for the service.ingresses: - # The port number that the service is exposed on internally.# This defaults to the first specified port for the service.port:# The ingress path that should be matched to route to this service.path:# The protocol to use for the ingress.protocol:# The hostname where the service can be accessed.hostname:# Latest status message of the service (if any).lastMessage:# Latest error status message of the service (if any).lastError:# A map of values output from the service.outputs:<name>:# How many replicas of the service are currently running.runningReplicas:# The current deployment status of the service.state:# When the service was last updated by the provider.updatedAt:# Set to true if the build was not attempted, e.g. if a dependency build failed.aborted:# The duration of the build in msec, if applicable.durationMsec:# Whether the build was succeessful.success:# An error message, if the build failed.error:# The version of the module, service, task or test.version:# A map of all tests that were run (or scheduled/attempted) and the test results.tests:<test name>:# The name of the module that was run.moduleName:# The command that was run in the module.command:# The exit code of the run (if applicable).exitCode:# When the module run was started.startedAt:# When the module run was completed.completedAt:# The output log from the run.log:namespaceStatus:pluginName:# Valid RFC1035/RFC1123 (DNS) label (may contain lowercase letters, numbers and dashes, must start with a# letter, and cannot end with a dash) and must not be longer than 63 characters.namespaceName:state:# A map of primitive values, output from the test.outputs:# Number, string or boolean<name>:# The name of the test that was run.testName:# Set to true if the build was not attempted, e.g. if a dependency build failed.aborted:# The duration of the build in msec, if applicable.durationMsec:# Whether the build was succeessful.success:# An error message, if the build failed.error:# The version of the module, service, task or test.version:# A map of all raw graph results. Avoid using this programmatically if you can, and use more structured keys instead.graphResults:
garden call
Call a service ingress endpoint.
Resolves the deployed ingress endpoint for the given service and path, calls the given endpoint and outputs the result.
Note: Currently only supports simple GET requests for HTTP/HTTPS ingresses.
Usage
garden call <serviceAndPath>
Arguments
garden config analytics-enabled
Update your preferences regarding analytics.
To help us make Garden better, you can opt in to the collection of usage data. We make sure all the data collected is anonymized and stripped of sensitive information. We collect data about which commands are run, what tasks they trigger, which API calls are made to your local Garden server, as well as some info about the environment in which Garden runs.
You will be asked if you want to opt-in when running Garden for the first time and you can use this command to update your preferences later.
Creates a new Garden project configuration. The generated config includes some default values, as well as the schema of the config in the form of commentented-out fields. Also creates a default (blank) .gardenignore file in the same path.
Examples:
garden create project # create a Garden project config in the current directory
garden create project --dir some-dir # create a Garden project config in the ./some-dir directory
garden create project --name my-project # set the project name to my-project
garden create project --interactive=false # don't prompt for user inputs when creating the config
Usage
garden create project [options]
Options
garden create module
Create a new Garden module.
Creates a new Garden module configuration. The generated config includes some default values, as well as the schema of the config in the form of commentented-out fields.
Examples:
garden create module # create a Garden module config in the current directory
garden create module --dir some-dir # create a Garden module config in the ./some-dir directory
garden create module --name my-module # set the module name to my-module
garden create module --interactive=false # don't prompt for user inputs when creating the module
Usage
garden create module [options]
Options
garden delete secret
Delete a secret from the environment.
Returns with an error if the provided key could not be found by the provider.
Examples:
garden delete secret kubernetes somekey
garden del secret local-kubernetes some-other-key
Usage
garden delete secret <provider> <key>
Arguments
garden delete environment
Deletes a running environment.
This will delete all services in the specified environment, and trigger providers to clear up any other resources and reset it. When you then run garden deploy, the environment will be reconfigured.
This can be useful if you find the environment to be in an inconsistent state, or need/want to free up resources.
Usage
garden delete environment [options]
Options
Outputs
# The status of each provider in the environment.providerStatuses:# Description of an environment's status for a provider.<name>:# Set to true if the environment is fully configured for a provider.ready:# Use this to include additional information that is specific to the provider.detail:namespaceStatuses: - pluginName:# Valid RFC1035/RFC1123 (DNS) label (may contain lowercase letters, numbers and dashes, must start with a# letter, and cannot end with a dash) and must not be longer than 63 characters.namespaceName:state:# Output variables that modules and other variables can reference.outputs:<name>:# Set to true to disable caching of the status.disableCache:# The status of each service in the environment.serviceStatuses:<name>:# When the service was first deployed by the provider.createdAt:# Additional detail, specific to the provider.detail:# Whether the service was deployed with dev mode enabled.devMode:# Whether the service was deployed with local mode enabled.localMode:namespaceStatuses: - pluginName:# Valid RFC1035/RFC1123 (DNS) label (may contain lowercase letters, numbers and dashes, must start with a# letter, and cannot end with a dash) and must not be longer than 63 characters.namespaceName:state:# The ID used for the service by the provider (if not the same as the service name).externalId:# The provider version of the deployed service (if different from the Garden module version.externalVersion:# A list of ports that can be forwarded to from the Garden agent by the provider.forwardablePorts: - # A descriptive name for the port. Should correspond to user-configured ports where applicable.name: