gentle-umbrella-55872
05/01/2024, 3:21 PMmicroscopic-river-74022
05/01/2024, 3:21 PMmicroscopic-river-74022
05/01/2024, 3:22 PM${actions.deploy.<name>.mode}
template string or ${this.mode}
if referenced in the action itself.
Here is an example config that works with both Bonsai and 0.12. In this block the variables sync-mode
or dev-mode
are set to true if the relative mode is requested for the api
service/deploy.
yaml
variables:
sync-mode: ${command.params contains 'sync' && (command.params.sync contains 'api' || isEmpty(command.params.sync))}
dev-mode: ${command.name == 'dev' || (command.params contains 'dev-mode' && (command.params.dev-mode contains 'api' || isEmpty(command.params.dev-mode)))}
Sync mode or dev mode have been requested if either var.sync-mode
or var.dev-mode
are true. You can use a template expression like ${var.sync-mode || var.dev-mode ? 'yes' : 'no'}
to change the behavior of your actions or modules.
For more information, you can check out the Garden documentation ().
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------gentle-umbrella-55872
05/01/2024, 3:22 PMgentle-umbrella-55872
05/01/2024, 3:23 PMmicroscopic-river-74022
05/01/2024, 3:23 PMmicroscopic-river-74022
05/01/2024, 3:23 PMspec.targetStage
field. Here is an example:
yaml
kind: Build
name: my-build
type: container
spec:
targetStage: <your-target-stage>
Replace <your-target-stage>
with the name of the stage you want to target in your Dockerfile.
For more information, you can refer to the Garden documentation ().
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------gentle-umbrella-55872
05/01/2024, 3:24 PMmicroscopic-river-74022
05/01/2024, 3:24 PMmicroscopic-river-74022
05/01/2024, 3:24 PMyaml
kind: Build
name: my-build
type: container
spec:
targetStage: ${{var.sync-mode || var.dev-mode ? 'sync-target-stage' : 'default-target-stage'}}
In this example, if the sync-mode
or dev-mode
variable is true, the targetStage
will be set to 'sync-target-stage'
. Otherwise, it will be set to 'default-target-stage'
. You should replace 'sync-target-stage'
and 'default-target-stage'
with the names of the stages in your Dockerfile.
Please note that this is a hypothetical example and the actual implementation may vary based on your specific use case and Dockerfile configuration. For more information on how to use template strings in Garden, you can refer to the Garden documentation ().
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------