manage dependencies

Use call func to chain dependencies

We are used to the way the dependencies are managed in build tasks, such as in Makefile, we list the pre tasks to be executed prior to the named task

In UP, we simply use call instead

It is designed this way for composibility and flexibility so that task and steps are consumable and reusable.

Demo

source

Main task yaml file
    tasks:
    - name: pre_task
      desc: this is pre-task
      task:
      - func: shell
        do:
        - echo "hello"
    - name: post_task
      desc: this is post-task
      task:
      - func: shell
        desc: do step1 in shell func
        do:
        - echo "world"
    - name: 2ndtask
      task:
      - func: shell
        desc: to test multiple refs
        do:
        - echo "this is 2nd task"
    - name: task
      desc: this is the task and expect the final message (hello I love this world)
      task:
      - func: call
        do: pre_task
      - func: shell
        do:
        - echo " I love this "
      - func: call
        do:
        - post_task
        - 2ndtask
    
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 -> c0005
                 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/c0005
    module: [self], instance id: [dev], exec profile: []
    profile -  envVars:
    
    (*core.Cache)({
    })
    
    Task4: [task ==> task: this is the task and expect the final message (hello I love this world) ]
    -Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "up_runtime_task_layer_number": 0
    })
    
    =Task1: [task ==> pre_task: this is pre-task ]
    --Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "up_runtime_task_layer_number": 1
    })
    
    cmd( 1):
    echo "hello"
    
    -
    hello
    
    -
     .. ok
    . ok
    -Step2:
    self: final context exec vars:
    
    (*core.Cache)({
      "up_runtime_task_layer_number": 1
    })
    
    cmd( 1):
    echo " I love this "
    
    -
     I love this 
    
    -
     .. ok
    . ok
    -Step3:
    self: final context exec vars:
    
    (*core.Cache)({
      "last_result": (*utils.ExecResult)({
        Cmd: "echo \" I love this \"",
        Code: 0,
        Output: "I love this",
        ErrMsg: ""
      }),
      "up_runtime_task_layer_number": 1
    })
    
    =Task2: [task ==> post_task: this is post-task ]
    --Step1: [: do step1 in shell func ]
    self: final context exec vars:
    
    (*core.Cache)({
      "last_result": (*utils.ExecResult)({
        Cmd: "echo \" I love this \"",
        Code: 0,
        Output: "I love this",
        ErrMsg: ""
      }),
      "up_runtime_task_layer_number": 1
    })
    
    cmd( 1):
    echo "world"
    
    -
    world
    
    -
     .. ok
    . ok
    =Task3: [task ==> 2ndtask:  ]
    --Step1: [: to test multiple refs ]
    self: final context exec vars:
    
    (*core.Cache)({
      "last_result": (*utils.ExecResult)({
        Cmd: "echo \"world\"",
        Code: 0,
        Output: "world",
        ErrMsg: ""
      }),
      "up_runtime_task_layer_number": 1
    })
    
    cmd( 1):
    echo "this is 2nd task"
    
    -
    this is 2nd task
    
    -
     .. ok
    . ok
    
Logs with different verbose level
Raw logs with different verbose level