Workflow configuration context
The below keys are available in template strings for Workflow configurations, as well as the commands defined in Custom Commands.
Note that the {steps.*}
key is only available for the steps[].command
and steps[].script
fields in Workflow configs, and may only reference previous steps in the same workflow. See below for more details.
${local.*}
${local.*}
Context variables that are specific to the currently running environment/machine.
object
${local.artifactsPath}
${local.artifactsPath}
The absolute path to the directory where exported artifacts from test and task runs are stored.
string
Example:
${local.env.*}
${local.env.*}
A map of all local environment variables (see https://nodejs.org/api/process.html#process_process_env).
object
${local.env.<env-var-name>}
${local.env.<env-var-name>}
The environment variable value.
string
${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)
string
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)
string
Example:
${local.projectPath}
${local.projectPath}
The absolute path to the project root directory.
string
Example:
${local.username}
${local.username}
The current username (as resolved by https://github.com/sindresorhus/username).
string
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.
string
Example:
${command.*}
${command.*}
Information about the currently running command and its arguments.
object
${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 "run 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.
string
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.
For example, to see if a service is in hot-reload mode, you might do something like ${command.params contains 'hot-reload' && command.params.hot-reload contains 'my-service'}
. Notice that you currently need to check both for the existence of the parameter, and also to correctly handle the array value.
Option values can be referenced by the option's default name (e.g. dev-mode
) or its alias (e.g. dev
) if one is defined for that option.
object
${command.params.<name>}
${command.params.<name>}
any
${datetime.*}
${datetime.*}
Information about the date/time at template resolution time.
object
${datetime.now}
${datetime.now}
The current UTC date and time, at time of template resolution, in ISO-8601 format.
string
Example:
${datetime.today}
${datetime.today}
The current UTC date, at time of template resolution, in ISO-8601 format.
string
Example:
${datetime.timestamp}
${datetime.timestamp}
The current UTC Unix timestamp (in seconds), at time of template resolution.
string
Example:
${project.*}
${project.*}
Information about the Garden project.
object
${project.name}
${project.name}
The name of the Garden project.
string
Example:
${git.*}
${git.*}
Information about the current state of the project's Git repository.
object
${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).
string
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).
string
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).
string
Example:
${secrets.<secret-name>}
${secrets.<secret-name>}
The secret's value.
string
${variables.*}
${variables.*}
A map of all variables defined in the project configuration, including environment-specific variables.
object
{}
${variables.<variable-name>}
${variables.<variable-name>}
string | number | boolean | link | array[link]
${var.*}
${var.*}
Alias for the variables field.
object
{}
${var.<name>}
${var.<name>}
Number, string or boolean
string | number | boolean
${environment.*}
${environment.*}
Information about the environment that Garden is running against.
object
${environment.name}
${environment.name}
The name of the environment Garden is running against, excluding the namespace.
string
Example:
${environment.fullName}
${environment.fullName}
The full name of the environment Garden is running against, including the namespace.
string
Example:
${environment.namespace}
${environment.namespace}
The currently active namespace (if any).
string
Example:
${steps.*}
${steps.*}
Reference previous steps in a workflow. Only available in the steps[].command
and steps[].script
fields. The name of the step should be the explicitly set name
of the other step, or if one is not set, use step-<n>
, where is the sequential number of the step (starting from 1).
object
{}
${steps.<step-name>.log}
${steps.<step-name>.log}
The full output log from the step.
string
${steps.<step-name>.outputs.*}
${steps.<step-name>.outputs.*}
The outputs returned by the step, as a mapping. Script steps will always have stdout
and stderr
keys. Command steps return different keys, including potentially nested maps and arrays. Please refer to each command for its output schema.
object
{}
${steps.<step-name>.outputs.<output-key>}
${steps.<step-name>.outputs.<output-key>}
string | number | boolean | link | array[link]
Last updated