Release Announcement: Garden 0.12.24

Garden 0.12.24 is out! :tada:

This release includes several bugfixes and improvements to performance and stability.

It also introduces module-level variables, which are great for reducing clutter in the project configuration of large projects. More on those below.

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

Many thanks to @toqueteos (Carlos Cobo) for his contribution to this release, and to everyone who’s been providing feedback and suggestions—happy hacking!

Module-level variables

Each Garden module can now specify its own set of variables, that can be re-used within the module, as well as referenced by other dependant modules.

If your project variable list is becoming cluttered with variables that are only used by a single module (or a subset of them), then these module-level variables can help keep things tidy.

Simply specify the variables field on the module, same as in the project configuration. For example:

kind: Module
name: my-service
variables:
  # This overrides the project-level hostname variable
  hostname: my-service.${var.hostname}
  # You can specify maps or lists as variables
  envVars:
    LOG_LEVEL: debug
    DATABASE_PASSWORD: ${var.database-password}
services:
  - name: my-service
    ...
    ingresses:
      - path: /
        port: http
        # This resolved to the hostname variable set above,
        # not the project-level one
        hostname: ${var.hostname}
    # Referencing the above envVar module variable
    env: ${var.envVars}
tests:
  - name: my-test
    ...
    # Re-using the envVar module variable
    env: ${var.envVars}

Notice that you can override variables defined at the project-level, and even reference project-scoped variables when defining the module variables.

Also notice the generally handy use-case of re-using a common value (in this case a map of environment variables) in multiple spots in the module configuration.

Referencing module variables

On top of that, you can reference the resolved module variables in other modules. With the above example, another module might for example reference ${modules.my-service.var.hostname}. For larger projects this can be much cleaner than, say, hoisting a lot of variables up to the project level.

Template strings in remote source configs

Template strings in remote sources now have access to the var key, among many others.

This adds a lot of flexibility when using remote sources in conjunction with automation (e.g. when using dynamic Git branches / tags for remote sources, depending on project- and environment-level variables).

See the template variable reference for remote sources for a full list of variables available in remote source configs.