define_context¶
Operation to context variables to the operation context.
Example¶
The following example adds a dictionary named template_variables with a single
variable named name to the context:
examples/operations/define_context.yml¶steps:
"Define name to greet":
name: define_context
context_defs:
template_variables:
name: "World"
"Display greeting":
name: echo
message: |
Hello, {{ qwikstart.name }}!
To complete the example, the variable is used by the echo operation to display
a simple hello-world greeting. Note that the template_variables dictionary, a.k.a.
namespace, is used by default when rendering templates by the echo operation, and
any other operations that render templates.
Required context¶
context_defsDefinition of variables to add to the context. Values can be defined using template variables; e.g.:
context_defs: greeting: "Hello {{ qwikstart.name }}!"
Optional context¶
template_variablesDictionary of variables available when rendering the file template.
template_variable_prefixdefault:
'qwikstart'Template variables will be nested in this namespace when rendering; e.g:
{{<template_variable_prefix>.your_template_variable}}
Output¶
This operation can define arbitrary output values based on context_defs.
Additional notes¶
Overrides default opconfig with:
display_description:False