taskScope vars in callee
This is a test case to show that the taskScope var could be passed to callee task and it will override what has been defined in callee if the var name is same
Demo
source
Main task yaml file
vars:
tom: this is tom
tasks:
- name: task
task:
- func: cmd
dvars:
- name: jerry
value: this is jerry in task scope
flags:
- taskScope
do:
- name: print
desc: this should print out the dvar value of jerry
cmd: '{{.jerry}}'
- func: call
do:
- subtask1
- name: subtask1
task:
- func: cmd
do:
- name: print
desc: this should print out the dvar value of jerry as it is declared jerry
is in taskScope
cmd: '{{.jerry}}'
- name: trace
cmd: ===>
- func: cmd
vars:
jerry: jerry is overriden in local scope
do:
- name: print
desc: |
remember that the caller's vars should override callee's vars
so jerry's value should the one from caller instead this local value
cmd: '{{.jerry}}'
- name: trace
cmd: <===
- name: trace
cmd: '--->'
- func: cmd
do:
- name: print
desc: this should print out the jerry defined in caller's task var scope
cmd: '{{.jerry}}'
- name: trace
cmd: <---
Main log file
loading [Config]: ./tests/functests/upconfig.yml
Main config:
Version -> 1.0.0
RefDir -> ./tests/functests
WorkDir -> cwd
AbsWorkDir -> /up_project/up
TaskFile -> c0109
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/c0109
module: [self], instance id: [dev], exec profile: []
profile - envVars:
(*core.Cache)({
})
Task1: [task ==> task: ]
-Step1:
self: final context exec vars:
(*core.Cache)({
"tom": "this is tom",
"up_runtime_task_layer_number": 0,
"jerry": "this is jerry in task scope"
})
~SubStep1: [print: this should print out the dvar value of jerry ]
this is jerry in task scope
-Step2:
self: final context exec vars:
(*core.Cache)({
"tom": "this is tom",
"up_runtime_task_layer_number": 0,
"jerry": "this is jerry in task scope"
})
=Task2: [task ==> subtask1: ]
--Step1:
self: final context exec vars:
(*core.Cache)({
"jerry": "this is jerry in task scope",
"tom": "this is tom",
"up_runtime_task_layer_number": 1
})
~~SubStep1: [print: this should print out the dvar value of jerry as it is declared jerry is in taskScope ]
this is jerry in task scope
~~SubStep2: [trace: ]
Trace:===>
--Step2:
self: final context exec vars:
(*core.Cache)({
"jerry": "this is jerry in task scope",
"tom": "this is tom",
"up_runtime_task_layer_number": 1
})
~~SubStep1: [print: remember that the caller's vars should override callee's vars
so jerry's value should the one from caller instead this local value
]
this is jerry in task scope
~~SubStep2: [trace: ]
Trace:<===
~~SubStep3: [trace: ]
Trace:--->
--Step3:
self: final context exec vars:
(*core.Cache)({
"up_runtime_task_layer_number": 1,
"jerry": "this is jerry in task scope",
"tom": "this is tom"
})
~~SubStep1: [print: this should print out the jerry defined in caller's task var scope ]
this is jerry in task scope
~~SubStep2: [trace: ]
Trace:<---
Logs with different verbose level
Raw logs with different verbose level