dynamic routing extra
This case shows that you can use combination of if statement and a var reference in your callee task name
Demo
source
Main task yaml file
tasks:
- name: task
task:
- func: call
vars:
person:
name: tom
age: 23
do:
- '{{.person.name}}_action'
if: '{{gt .person.age 20}}'
- name: tom_action
task:
- func: cmd
do:
- name: print
cmd: 'hello {{.person.name}}'
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 -> c0093
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/c0093
module: [self], instance id: [dev], exec profile: []
profile - envVars:
(*core.Cache)({
})
Task1: [task ==> task: ]
-Step1:
self: final context exec vars:
(*core.Cache)({
"person": {
"name": "tom",
"age": 23
},
"up_runtime_task_layer_number": 0
})
=Task2: [task ==> tom_action: ]
--Step1:
self: final context exec vars:
(*core.Cache)({
"person": {
"name": "tom",
"age": 23
},
"up_runtime_task_layer_number": 1
})
~~SubStep1: [print: ]
hello tom
Logs with different verbose level
Raw logs with different verbose level