Please note you can use plain raw value for dvar value, however it is better to manage the string constant as a configuration entry as a var item
vars:
school: Sydney Grammar
dvars:
- name: nv #case 1: reference to dvar
value: "n=>{{.school}}"
- name: m
value: m=>{{.nv}}
expand: 1
desc: |
the expand should be 1 as n is already instanciated a actual value
- name: j
value: j=>{{.m}}
expand: 1
desc: |
the expand should be 1 as n is already instanciated a actual value
#case 2: reference to var
- name: o
value: o=>{{.c}}
expand: 3
desc: |
the expand should be 3 as the reference in vars not evaluated yet
this eventually will be the value of school from vars
#case 3: it allows you to put non templated string there as value in dvars
- name: z
value: i am zzz
desc: you can use plain string here too
- name: yv
value: y->{{.z}}
- name: x
value: x=>{{.yv}}
expand: 1
desc: |
you can't expect to use expand level 2 to get value z, as there is no need
to do so because y should be already rendered
tasks:
- name: task
task:
- func: shell
do:
- echo "n->{{.nv}}"
- echo "m->{{.m}}"
- echo "j->{{.j}}"
- echo "o->{{.o}}"
- echo "z->{{.z}}"
- echo "y->{{.yv}}"
- echo "x->{{.x}}"
loading [Config]: ./tests/functests/upconfig.yml
Main config:
Version -> 1.0.0
RefDir -> ./tests/functests
WorkDir -> cwd
AbsWorkDir -> /up_project/up
TaskFile -> c0050
Verbose -> vvv
ModuleName -> self
ShellType -> /bin/sh
MaxCallLayers -> 8
Timeout -> 3600000
MaxModuelCallLayers -> 256
EntryTask -> task
ModRepoUsernameRef ->
ModRepoPasswordRef ->
work dir: /up_project/up
-exec task: task
loading [Task]: ./tests/functests/c0050
module: [self], instance id: [dev], exec profile: []
profile - envVars:
(*core.Cache)({
})
Task1: [task ==> task: ]
-Step1:
self: final context exec vars:
(*core.Cache)({
"school": "Sydney Grammar",
"x": "x=>y->i am zzz",
"nv": "n=>Sydney Grammar",
"z": "i am zzz",
"j": "j=>m=>n=>Sydney Grammar",
"yv": "y->i am zzz",
"o": "o=><no value>",
"up_runtime_task_layer_number": 0,
"m": "m=>n=>Sydney Grammar"
})
cmd( 1):
echo "n->{{.nv}}"
-
n->n=>Sydney Grammar
-
.. ok
cmd( 2):
echo "m->{{.m}}"
-
m->m=>n=>Sydney Grammar
-
.. ok
cmd( 3):
echo "j->{{.j}}"
-
j->j=>m=>n=>Sydney Grammar
-
.. ok
cmd( 4):
echo "o->{{.o}}"
-
o->o=><no value>
-
.. ok
cmd( 5):
echo "z->{{.z}}"
-
z->i am zzz
-
.. ok
cmd( 6):
echo "y->{{.yv}}"
-
y->y->i am zzz
-
.. ok
cmd( 7):
echo "x->{{.x}}"
-
x->x=>y->i am zzz
-
.. ok
. ok