Action (all fields) template context
The below keys are available in template strings for built-in fields in action configs, i.e. everything except the spec
field. Please see here for all the additional fields available under the spec
field.
Actions can reference outputs defined by providers, via the ${providers.<provider-name>.outputs}
key. For details on which outputs are available for a given provider, please refer to the reference docs for the provider in question, and look for the Outputs section.
Note that the built-in config fields do not allow referencing other actions or modules, whereas it is allowed under the spec
field (see here for more details).
${local.*}
${local.*}
Context variables that are specific to the currently running environment/machine.
Type |
---|
|
${local.artifactsPath}
${local.artifactsPath}
The absolute path to the directory where exported artifacts from test and task runs are stored.
Type |
---|
|
Example:
${local.env.*}
${local.env.*}
A map of all local environment variables (see https://nodejs.org/api/process.html#process_process_env).
Type |
---|
|
${local.env.<env-var-name>}
${local.env.<env-var-name>}
The environment variable value.
Type |
---|
|
${local.arch}
${local.arch}
A string indicating the architecture that the framework is running on (see https://nodejs.org/api/process.html#process_process_arch)
Type |
---|
|
Example:
${local.platform}
${local.platform}
A string indicating the platform that the framework is running on (see https://nodejs.org/api/process.html#process_process_platform)
Type |
---|
|
Example:
${local.projectPath}
${local.projectPath}
The absolute path to the project root directory.
Type |
---|
|
Example:
${local.username}
${local.username}
The current username (as resolved by https://github.com/sindresorhus/username).
Type |
---|
|
Example:
${local.usernameLowerCase}
${local.usernameLowerCase}
The current username (as resolved by https://github.com/sindresorhus/username), with any upper case characters converted to lower case.
Type |
---|
|
Example:
${command.*}
${command.*}
Information about the currently running command and its arguments.
Type |
---|
|
${command.name}
${command.name}
The currently running Garden CLI command, without positional arguments or option flags. This can be handy to e.g. change some variables based on whether you're running garden test
or some other specific command.
Note that this will currently always resolve to "workflow"
when running Workflows, as opposed to individual workflow step commands. This may be revisited at a later time, but currently all configuration is resolved once for all workflow steps.
Type |
---|
|
Example:
${command.params.*}
${command.params.*}
A map of all parameters set when calling the current command. This includes both positional arguments and option flags, and includes any default values set by the framework or specific command. This can be powerful if used right, but do take care since different parameters are only available in certain commands, some have array values etc.
Option values can be referenced by the option's default name (e.g. local-mode
) or its alias (e.g. local
) if one is defined for that option.
Type |
---|
|
${command.params.<name>}
${command.params.<name>}
Type |
---|
|
${datetime.*}
${datetime.*}
Information about the date/time at template resolution time.
Type |
---|
|
${datetime.now}
${datetime.now}
The current UTC date and time, at time of template resolution, in ISO-8601 format.
Type |
---|
|
Example:
${datetime.today}
${datetime.today}
The current UTC date, at time of template resolution, in ISO-8601 format.
Type |
---|
|
Example:
${datetime.timestamp}
${datetime.timestamp}
The current UTC Unix timestamp (in seconds), at time of template resolution.
Type |
---|
|
Example:
${project.*}
${project.*}
Information about the Garden project.
Type |
---|
|
${project.name}
${project.name}
The name of the Garden project.
Type |
---|
|
Example:
${git.*}
${git.*}
Information about the current state of the project's Git repository.
Type |
---|
|
${git.branch}
${git.branch}
The current Git branch, if available. Resolves to an empty string if HEAD is in a detached state (e.g. when rebasing), or if the repository has no commits.
When using remote sources, the branch used is that of the project/top-level repository (the one that contains the project configuration).
The branch is resolved at the start of the Garden command's execution, and is not updated if the current branch changes during the command's execution (which could happen, for example, when using watch-mode commands).
Type |
---|
|
Example:
${git.commitHash}
${git.commitHash}
The current Git commit hash, if available. Resolves to an empty string if the repository has no commits.
When using remote sources, the hash used is that of the project/top-level repository (the one that contains the project configuration).
The hash is resolved at the start of the Garden command's execution, and is not updated if the current commit changes during the command's execution (which could happen, for example, when using watch-mode commands).
Type |
---|
|
Example:
${git.originUrl}
${git.originUrl}
The remote origin URL of the project Git repository.
When using remote sources, the URL is that of the project/top-level repository (the one that contains the project configuration).
Type |
---|
|
Example:
${secrets.<secret-name>}
${secrets.<secret-name>}
The secret's value.
Type |
---|
|
${variables.*}
${variables.*}
A map of all variables defined in the project configuration, including environment-specific variables.
Type | Default |
---|---|
|
|
${variables.<variable-name>}
${variables.<variable-name>}
Type |
---|
|
${var.*}
${var.*}
Alias for the variables field.
Type | Default |
---|---|
|
|
${var.<name>}
${var.<name>}
Number, string or boolean
Type |
---|
|
${environment.*}
${environment.*}
Information about the environment that Garden is running against.
Type |
---|
|
${environment.name}
${environment.name}
The name of the environment Garden is running against, excluding the namespace.
Type |
---|
|
Example:
${environment.fullName}
${environment.fullName}
The full name of the environment Garden is running against, including the namespace.
Type |
---|
|
Example:
${environment.namespace}
${environment.namespace}
The currently active namespace (if any).
Type |
---|
|
Example:
${inputs.*}
${inputs.*}
The inputs provided to the config through a template, if applicable.
Type | Default |
---|---|
|
|
${inputs.<input-key>}
${inputs.<input-key>}
Type |
---|
|
${parent.*}
${parent.*}
Information about the config parent, if any (usually a template, if applicable).
Type |
---|
|
${parent.name}
${parent.name}
The name of the parent config.
Type |
---|
|
${template.*}
${template.*}
Information about the template used when generating the config, if applicable.
Type |
---|
|
${template.name}
${template.name}
The name of the template.
Type |
---|
|
${this.*}
${this.*}
Information about the action currently being resolved.
Type |
---|
|
${this.name}
${this.name}
The name of the action.
Type |
---|
|
${this.mode}
${this.mode}
The mode that the action should be executed in (e.g. 'sync' or 'local' for Deploy actions). Set to 'default' if no special mode is being used.
Build actions inherit the mode from Deploy actions that depend on them. E.g. If a Deploy action is in 'sync' mode and depends on a Build action, the Build action will inherit the 'sync' mode setting from the Deploy action. This enables installing different tools that may be necessary for different development modes.
Type | Default |
---|---|
|
|
Example:
Last updated