multi-layers loop 1

This case demos 3 layers of loop to show the loopitem in each layer is from parent and the callee will inherit all vars/dvars from caller chain through to the root caller

Demo

source

Main task yaml file
    tasks:
    - name: task
      task:
      - func: call
        vars:
          layer1_aaa: layer1_aaa
          layer1_bbb: layer1_bbb
        do:
        - layer2
        loop:
        - layer1-tom
        - layer1-peter
        - layer1-james
    - name: layer2
      task:
      - func: cmd
        do:
        - name: print
          cmd: 'hello {{.loopitem}}'
        - name: print
          cmd: 'hello layer1_aaa: {{.layer1_aaa}}'
      - func: call
        vars:
          layer2_aaa: layer2_aaa
          layer2_bbb: layer2_bbb
        do:
        - layer3
        loop:
        - layer2-tom
        - layer2-peter
        - layer2-james
    - name: layer3
      task:
      - func: cmd
        do:
        - name: print
          cmd: 'hello {{.loopitem}}'
        - name: print
          cmd: 'hello layer1_aaa: {{.layer1_aaa}}'
        - name: print
          cmd: 'hello layer2_aaa: {{.layer2_aaa}}'
    
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 -> c0091
                 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/c0091
    module: [self], instance id: [dev], exec profile: []
    profile -  envVars:
    
    (*core.Cache)({
    })
    
    Task1: [task ==> task:  ]
    -Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "layer1_aaa": "layer1_aaa",
      "layer1_bbb": "layer1_bbb",
      "up_runtime_task_layer_number": 0
    })
    
    =Task2: [task ==> layer2:  ]
    --Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "layer1_bbb": "layer1_bbb",
      "loopitem": "layer1-tom",
      "loopindex": 0,
      "loopindex1": 1,
      "up_runtime_task_layer_number": 1,
      "layer1_aaa": "layer1_aaa"
    })
    
    ~~SubStep1: [print:  ]
    hello layer1-tom
    ~~SubStep2: [print:  ]
    hello layer1_aaa: layer1_aaa
    --Step2:
    self: final context exec vars:
    
    (*core.Cache)({
      "layer1_bbb": "layer1_bbb",
      "loopitem": "layer1-tom",
      "loopindex": 0,
      "loopindex1": 1,
      "layer2_aaa": "layer2_aaa",
      "layer2_bbb": "layer2_bbb",
      "up_runtime_task_layer_number": 1,
      "layer1_aaa": "layer1_aaa"
    })
    
    ==Task3: [task/layer2 ==> layer3:  ]
    ---Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "layer2_bbb": "layer2_bbb",
      "up_runtime_task_layer_number": 2,
      "layer1_aaa": "layer1_aaa",
      "layer1_bbb": "layer1_bbb",
      "loopitem": "layer2-tom",
      "loopindex": 0,
      "loopindex1": 1,
      "layer2_aaa": "layer2_aaa"
    })
    
    ~~~SubStep1: [print:  ]
    hello layer2-tom
    ~~~SubStep2: [print:  ]
    hello layer1_aaa: layer1_aaa
    ~~~SubStep3: [print:  ]
    hello layer2_aaa: layer2_aaa
    ==Task3: [task/layer2 ==> layer3:  ]
    ---Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "layer2_aaa": "layer2_aaa",
      "layer2_bbb": "layer2_bbb",
      "up_runtime_task_layer_number": 2,
      "layer1_aaa": "layer1_aaa",
      "layer1_bbb": "layer1_bbb",
      "loopitem": "layer2-peter",
      "loopindex": 1,
      "loopindex1": 2
    })
    
    ~~~SubStep1: [print:  ]
    hello layer2-peter
    ~~~SubStep2: [print:  ]
    hello layer1_aaa: layer1_aaa
    ~~~SubStep3: [print:  ]
    hello layer2_aaa: layer2_aaa
    ==Task3: [task/layer2 ==> layer3:  ]
    ---Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "loopitem": "layer2-james",
      "loopindex": 2,
      "loopindex1": 3,
      "layer2_aaa": "layer2_aaa",
      "layer2_bbb": "layer2_bbb",
      "up_runtime_task_layer_number": 2,
      "layer1_aaa": "layer1_aaa",
      "layer1_bbb": "layer1_bbb"
    })
    
    ~~~SubStep1: [print:  ]
    hello layer2-james
    ~~~SubStep2: [print:  ]
    hello layer1_aaa: layer1_aaa
    ~~~SubStep3: [print:  ]
    hello layer2_aaa: layer2_aaa
    =Task2: [task ==> layer2:  ]
    --Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "loopitem": "layer1-peter",
      "loopindex": 1,
      "loopindex1": 2,
      "up_runtime_task_layer_number": 1,
      "layer1_aaa": "layer1_aaa",
      "layer1_bbb": "layer1_bbb"
    })
    
    ~~SubStep1: [print:  ]
    hello layer1-peter
    ~~SubStep2: [print:  ]
    hello layer1_aaa: layer1_aaa
    --Step2:
    self: final context exec vars:
    
    (*core.Cache)({
      "layer2_aaa": "layer2_aaa",
      "layer2_bbb": "layer2_bbb",
      "layer1_bbb": "layer1_bbb",
      "loopitem": "layer1-peter",
      "loopindex": 1,
      "loopindex1": 2,
      "up_runtime_task_layer_number": 1,
      "layer1_aaa": "layer1_aaa"
    })
    
    ==Task3: [task/layer2 ==> layer3:  ]
    ---Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "layer1_aaa": "layer1_aaa",
      "layer2_aaa": "layer2_aaa",
      "layer2_bbb": "layer2_bbb",
      "layer1_bbb": "layer1_bbb",
      "loopitem": "layer2-tom",
      "loopindex": 0,
      "loopindex1": 1,
      "up_runtime_task_layer_number": 2
    })
    
    ~~~SubStep1: [print:  ]
    hello layer2-tom
    ~~~SubStep2: [print:  ]
    hello layer1_aaa: layer1_aaa
    ~~~SubStep3: [print:  ]
    hello layer2_aaa: layer2_aaa
    ==Task3: [task/layer2 ==> layer3:  ]
    ---Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "layer2_aaa": "layer2_aaa",
      "layer2_bbb": "layer2_bbb",
      "layer1_bbb": "layer1_bbb",
      "loopitem": "layer2-peter",
      "loopindex": 1,
      "loopindex1": 2,
      "up_runtime_task_layer_number": 2,
      "layer1_aaa": "layer1_aaa"
    })
    
    ~~~SubStep1: [print:  ]
    hello layer2-peter
    ~~~SubStep2: [print:  ]
    hello layer1_aaa: layer1_aaa
    ~~~SubStep3: [print:  ]
    hello layer2_aaa: layer2_aaa
    ==Task3: [task/layer2 ==> layer3:  ]
    ---Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "loopindex": 2,
      "loopindex1": 3,
      "up_runtime_task_layer_number": 2,
      "layer1_aaa": "layer1_aaa",
      "layer2_aaa": "layer2_aaa",
      "layer2_bbb": "layer2_bbb",
      "layer1_bbb": "layer1_bbb",
      "loopitem": "layer2-james"
    })
    
    ~~~SubStep1: [print:  ]
    hello layer2-james
    ~~~SubStep2: [print:  ]
    hello layer1_aaa: layer1_aaa
    ~~~SubStep3: [print:  ]
    hello layer2_aaa: layer2_aaa
    =Task2: [task ==> layer2:  ]
    --Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "layer1_bbb": "layer1_bbb",
      "loopitem": "layer1-james",
      "loopindex": 2,
      "loopindex1": 3,
      "up_runtime_task_layer_number": 1,
      "layer1_aaa": "layer1_aaa"
    })
    
    ~~SubStep1: [print:  ]
    hello layer1-james
    ~~SubStep2: [print:  ]
    hello layer1_aaa: layer1_aaa
    --Step2:
    self: final context exec vars:
    
    (*core.Cache)({
      "layer1_bbb": "layer1_bbb",
      "loopitem": "layer1-james",
      "layer2_bbb": "layer2_bbb",
      "layer2_aaa": "layer2_aaa",
      "loopindex": 2,
      "loopindex1": 3,
      "up_runtime_task_layer_number": 1,
      "layer1_aaa": "layer1_aaa"
    })
    
    ==Task3: [task/layer2 ==> layer3:  ]
    ---Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "layer2_bbb": "layer2_bbb",
      "layer2_aaa": "layer2_aaa",
      "loopindex": 0,
      "loopindex1": 1,
      "up_runtime_task_layer_number": 2,
      "layer1_aaa": "layer1_aaa",
      "layer1_bbb": "layer1_bbb",
      "loopitem": "layer2-tom"
    })
    
    ~~~SubStep1: [print:  ]
    hello layer2-tom
    ~~~SubStep2: [print:  ]
    hello layer1_aaa: layer1_aaa
    ~~~SubStep3: [print:  ]
    hello layer2_aaa: layer2_aaa
    ==Task3: [task/layer2 ==> layer3:  ]
    ---Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "loopindex": 1,
      "loopindex1": 2,
      "up_runtime_task_layer_number": 2,
      "layer1_aaa": "layer1_aaa",
      "layer1_bbb": "layer1_bbb",
      "loopitem": "layer2-peter",
      "layer2_bbb": "layer2_bbb",
      "layer2_aaa": "layer2_aaa"
    })
    
    ~~~SubStep1: [print:  ]
    hello layer2-peter
    ~~~SubStep2: [print:  ]
    hello layer1_aaa: layer1_aaa
    ~~~SubStep3: [print:  ]
    hello layer2_aaa: layer2_aaa
    ==Task3: [task/layer2 ==> layer3:  ]
    ---Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "loopitem": "layer2-james",
      "layer2_bbb": "layer2_bbb",
      "layer2_aaa": "layer2_aaa",
      "loopindex": 2,
      "loopindex1": 3,
      "up_runtime_task_layer_number": 2,
      "layer1_aaa": "layer1_aaa",
      "layer1_bbb": "layer1_bbb"
    })
    
    ~~~SubStep1: [print:  ]
    hello layer2-james
    ~~~SubStep2: [print:  ]
    hello layer1_aaa: layer1_aaa
    ~~~SubStep3: [print:  ]
    hello layer2_aaa: layer2_aaa
    
Logs with different verbose level
Raw logs with different verbose level