gentle-umbrella-55872
06/11/2024, 4:51 AMmicroscopic-river-74022
06/11/2024, 4:51 AMmicroscopic-river-74022
06/11/2024, 4:51 AM${command.name}
template string to access the currently running Garden CLI command. This can be used to change some variables based on whether you're running garden test
or some other specific command.
Here's an example of how you might use it:
yaml
my-variable: ${command.name == 'test' ? 'value when test' : 'other value'}
In this example, my-variable
will be set to 'value when test'
when you're running garden test
, and 'other value'
otherwise.
Please 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.
For more information, you can refer to the Garden documentation on Project template context (), Environment template context (), and Project Output template context ().
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------microscopic-river-74022
06/11/2024, 4:51 AMgentle-umbrella-55872
06/11/2024, 4:56 AMmicroscopic-river-74022
06/11/2024, 4:56 AMmicroscopic-river-74022
06/11/2024, 4:57 AM${{command.*}}
to access information about the currently running command and its arguments. Reference ()
- ${{this.*}}
to access information about the current context (e.g., the current module, test, task, etc.).
- ${{variables.*}}
to access a map of all variables defined in the project configuration, including environment-specific variables. Reference ()
- ${{modules.<module-name>.var.*}}
to access a map of all variables defined in a specific module. Reference ()
To print all these variables, you can use the garden get config
command, which will output the configuration for your project, including all the variables. Here's an example:
bash
garden get config
This will print the configuration in the console. If you want to print it to a file, you can redirect the output like this:
bash
garden get config > config.txt
This will create a config.txt
file with the configuration.
Please note that the actual command to print the configuration may vary depending on your specific setup and the Garden version you're using.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------microscopic-river-74022
06/11/2024, 4:57 AMgentle-umbrella-55872
06/11/2024, 4:58 AMmicroscopic-river-74022
06/11/2024, 4:58 AMmicroscopic-river-74022
06/11/2024, 4:58 AMgarden test
command, the variables that are available are the ones defined in your project configuration, and any environment-specific variables. You can also use template strings to access information about the currently running command and its arguments, the current context, and more.
Here's an example of how you might define variables in your project configuration:
yaml
apiVersion: garden.io/v1
kind: Project
name: my-project
variables:
# This variable is referenced in the action configs, and overridden in the local environment below
service-replicas: 3
environments:
- name: local
variables:
# We only want one replica of each service when developing locally
service-replicas: 1
- name: staging
providers:
- name: local-kubernetes
environments: ["local"]
- name: kubernetes
environments: ["staging"]
...
In this example, the service-replicas
variable is defined at the project level and can be accessed in all the project's action configurations. It's also overridden in the local
environment.
To access these variables in your tests, you can use the ${var.*}
syntax. For example, ${var.service-replicas}
would access the service-replicas
variable.
To see the current configuration, including all variables, when running a garden test
command, you can use the garden get config
command. This will output the configuration for your project, including all the variables.microscopic-river-74022
06/11/2024, 4:58 AMmicroscopic-river-74022
06/11/2024, 4:58 AMgentle-umbrella-55872
06/11/2024, 4:59 AMmicroscopic-river-74022
06/11/2024, 4:59 AMmicroscopic-river-74022
06/11/2024, 4:59 AMgarden test
, you can use the garden get config
command. This command will output the configuration for your project, including all the variables.
Here's an example:
bash
garden get config
This will print the configuration in the console. If you want to print it to a file, you can redirect the output like this:
bash
garden get config > config.txt
This will create a config.txt
file with the configuration.
Please note that the actual command to print the configuration may vary depending on your specific setup and the Garden version you're using.
For more information, you can refer to the Garden documentation on Project template context (), Environment template context (), and Project Output template context ().
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------microscopic-river-74022
06/11/2024, 4:59 AM