call task from block

Showcase calling task from within block

It should override vars in callee’s task, however inherits all vars from vars within block func

Demo

source

Main task yaml file
    vars:
      a: global_aaa
      b: global_bbb
      c: global_ccc
    tasks:
    - name: task
      task:
      - func: block
        vars:
          a: local_aaa
          b: local_bbb
        dvars:
        - name: da
          value: local_da
        - name: db
          value: local_db
        do:
        - func: shell
          do:
          - echo "in block"
        - func: call
          do:
          - callee_task
    - name: callee_task
      task:
      - func: cmd
        vars:
          a: callee_aaa
        dvars:
        - name: db
          value: callee_db
        do:
        - name: print
          cmd: |
            layer 1
            up_runtime_task_layer_number: {{.up_runtime_task_layer_number}}
            a: {{.a}}
            b: {{.b}}
            c: {{.c}}
            da: {{.da}}
            db: {{.db}}
        - name: assert
          cmd:
          - '{{eq .a "local_aaa" }}'
          - '{{eq .b "local_bbb" }}'
          - '{{eq .c "global_ccc" }}'
          - '{{eq .da "local_da" }}'
          - '{{eq .db "callee_db" }}'
          flags: [failFast]
    
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 -> c0134
                 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/c0134
    module: [self], instance id: [dev], exec profile: []
    profile -  envVars:
    
    (*core.Cache)({
    })
    
    Task1: [task ==> task:  ]
    -Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "a": "local_aaa",
      "b": "local_bbb",
      "c": "global_ccc",
      "up_runtime_task_layer_number": 0,
      "da": "local_da",
      "db": "local_db"
    })
    
    -Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "up_runtime_task_layer_number": 0,
      "da": "local_da",
      "db": "local_db",
      "a": "local_aaa",
      "b": "local_bbb",
      "c": "global_ccc"
    })
    
    cmd( 1):
    echo "in block"
    
    -
    in block
    
    -
     .. ok
    . ok
    -Step2:
    self: final context exec vars:
    
    (*core.Cache)({
      "up_runtime_task_layer_number": 0,
      "da": "local_da",
      "db": "local_db",
      "a": "local_aaa",
      "b": "local_bbb",
      "c": "global_ccc",
      "last_result": (*utils.ExecResult)({
        Cmd: "echo \"in block\"",
        Code: 0,
        Output: "in block",
        ErrMsg: ""
      })
    })
    
    =Task2: [task ==> callee_task:  ]
    --Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "da": "local_da",
      "db": "callee_db",
      "b": "local_bbb",
      "c": "global_ccc",
      "last_result": (*utils.ExecResult)({
        Cmd: "echo \"in block\"",
        Code: 0,
        Output: "in block",
        ErrMsg: ""
      }),
      "up_runtime_task_layer_number": 1,
      "a": "local_aaa"
    })
    
    ~~SubStep1: [print:  ]
    layer 1
    up_runtime_task_layer_number: 1
    a: local_aaa
    b: local_bbb
    c: global_ccc
    da: local_da
    db: callee_db
    
    ~~SubStep2: [assert:  ]
     1 ASSERT OK:     [{{eq .a "local_aaa" }}]
     2 ASSERT OK:     [{{eq .b "local_bbb" }}]
     3 ASSERT OK:     [{{eq .c "global_ccc" }}]
     4 ASSERT OK:     [{{eq .da "local_da" }}]
     5 ASSERT OK:     [{{eq .db "callee_db" }}]
    
Logs with different verbose level
Raw logs with different verbose level