multiple layers overriding
This showcases the vars in callee will be overriden if there is a same name var passed from caller. This is a feature of call func
Demo
source
Main task yaml file
vars:
global_a: aaa
global_b: bbb
tasks:
- name: task
task:
- func: call
vars:
local_a: aaa
local_b: bbb
tom: my name is tom
do:
- subtask1
- name: subtask1
task:
- func: cmd
do:
- name: print
cmd: '{{.tom}}'
- name: assert
cmd:
- '{{eq .tom "my name is tom"}}'
- func: cmd
vars:
tom: 'hi i am tom'
do:
- name: print
cmd: '{{.tom}}'
- name: assert
cmd:
- '{{eq .tom "my name is tom"}}'
- func: call
do:
- subtask2
- name: subtask2
task:
- func: cmd
do:
- name: print
cmd: '{{.tom}}'
- name: assert
cmd:
- '{{eq .tom "my name is tom"}}'
- func: cmd
vars:
tom: 'hi i am tom'
do:
- name: print
cmd: '{{.tom}}'
- name: assert
cmd:
- '{{eq .tom "my name is tom"}}'
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 -> c0112
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/c0112
module: [self], instance id: [dev], exec profile: []
profile - envVars:
(*core.Cache)({
})
Task1: [task ==> task: ]
-Step1:
self: final context exec vars:
(*core.Cache)({
"global_a": "aaa",
"global_b": "bbb",
"up_runtime_task_layer_number": 0,
"tom": "my name is tom",
"local_a": "aaa",
"local_b": "bbb"
})
=Task2: [task ==> subtask1: ]
--Step1:
self: final context exec vars:
(*core.Cache)({
"global_a": "aaa",
"global_b": "bbb",
"up_runtime_task_layer_number": 1,
"tom": "my name is tom",
"local_a": "aaa",
"local_b": "bbb"
})
~~SubStep1: [print: ]
my name is tom
~~SubStep2: [assert: ]
1 ASSERT OK: [{{eq .tom "my name is tom"}}]
--Step2:
self: final context exec vars:
(*core.Cache)({
"local_b": "bbb",
"global_a": "aaa",
"global_b": "bbb",
"up_runtime_task_layer_number": 1,
"local_a": "aaa",
"tom": "my name is tom"
})
~~SubStep1: [print: ]
my name is tom
~~SubStep2: [assert: ]
1 ASSERT OK: [{{eq .tom "my name is tom"}}]
--Step3:
self: final context exec vars:
(*core.Cache)({
"tom": "my name is tom",
"local_a": "aaa",
"local_b": "bbb",
"global_a": "aaa",
"global_b": "bbb",
"up_runtime_task_layer_number": 1
})
==Task3: [task/subtask1 ==> subtask2: ]
---Step1:
self: final context exec vars:
(*core.Cache)({
"tom": "my name is tom",
"local_a": "aaa",
"local_b": "bbb",
"global_a": "aaa",
"global_b": "bbb",
"up_runtime_task_layer_number": 2
})
~~~SubStep1: [print: ]
my name is tom
~~~SubStep2: [assert: ]
1 ASSERT OK: [{{eq .tom "my name is tom"}}]
---Step2:
self: final context exec vars:
(*core.Cache)({
"local_a": "aaa",
"local_b": "bbb",
"global_a": "aaa",
"tom": "my name is tom",
"global_b": "bbb",
"up_runtime_task_layer_number": 2
})
~~~SubStep1: [print: ]
my name is tom
~~~SubStep2: [assert: ]
1 ASSERT OK: [{{eq .tom "my name is tom"}}]
Logs with different verbose level
Raw logs with different verbose level