Release Announcement: Garden 0.12.35

Garden 0.12.35 is out! :tada:

This release includes a big new feature: Custom commands! We’ve also added built-in support for Kustomize for the kubernetes module type. See the sections below for more details.

We’ve also updated the version of Mutagen we use to power dev mode, which should result in improved stability for long-running sync sessions.

Finally, we’ve substantially improved startup time for the Garden CLI.

Many thanks to @ohookins, @highb and @wojciechka for their contributions to this release.

See the changelog in the release notes for the full list of changes introduced in this release.

Happy hacking!

Custom Commands

As part of a Garden project, you can now define custom commands. You can think of these like Makefile targets, npm package scripts etc., except you have the full power of Garden’s templating syntax to work with, and can easily declare the exact arguments and options the command accepts. The custom commands come up when you run garden help, which helps make your project easier to use and more self-documenting.

You’ll find more examples and details in the custom commands guide, but here’s a simple example to illustrate the idea:

kind: Command
name: api-dev
  short: Start garden with preconfigured options for API development
    - sh
    - -c
    - git submodule update --recursive --remote  # Because we keep forgetting to update these, amirite?
  - deploy
  - --dev
  - api,worker
  - --log-level
  - debug
  - $concat: ${args.$all}  # Allow any arguments/options on top of the fixed ones above

Here we imagine a basic day-to-day workflow for a certain group of developers. The user simply runs garden api-dev. Before the Garden command starts, we update the submodules in the repo, and then we start garden deploy with some parameters that we tend to use or prefer.

Of course this is just an example, but no doubt you can imagine some commands, parameters etc. that you use a lot and which would be nice to codify for you and your team. And this example only uses a fraction of what’s possible!

Kustomize support

The kubernetes module type now has built-in support for Kustomize, via the new kustomize config field.

Kustomize is useful when you want to add dynamism to your Kubernetes manifests without using Helm templates.

When the kustomize config field is used, Garden will call kustomize build to render the service’s manifests before deploying.

Here’s a usage example from the newly added Kustomize example project:

kind: Module
type: kubernetes
name: hello-world
  # This is actually the default (running `kustomize build` in the module root), just setting it explicitly for clarity.
  path: .
    # Note: Not actually using this here, just setting as an example
    - --enable-alpha-plugins

See reference docs for the kubernets module type for more details.

Debug logfiles

The Garden CLI now creates logfiles at the debug log level in the project-level .garden directory (under .garden/logs).

The names of these logfiles include the command name, log level and the time the command was executed (as an ISO timestamp).

Logfiles older than 7 days are also automatically cleaned up when the CLI is called.

These logfiles can be useful for getting at more detailed logs for recently-run commands that were run at a less verbose log level.

We’re also planning to make these command logs easier to browse and view by adding a dedicated CLI command for viewing logs for past sessions at a specified log level. Stay tuned!