ref task

Showcase how to make the UP cmd cli configuration tidy, clean and more organized

Externalized the task definition - c0059-task-ref.yml

    flow:
      - func: shell
        do:
          - echo "step1"
          - echo "step2"
          - echo "step3"
    
      - func: shell
        do:
          - echo "step4"
          - echo "step5"
          - echo "step6"
    
      - func: shell
        do:
          - echo "step7"
          - echo "step8"
          - echo "step9"
    

flow element

Introduce the flow element to notate a task reference

With ref element in main tasks file, this will make the entry point much cleaner and the main skeleton design stand out

Demo

source

Main task yaml file
    goal:
    - introduce steps ref to externalise steps to yaml file
    tasks:
    - name: task
      ref: c0059-task-ref.yml
    
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 -> c0059
                 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/c0059
    module: [self], instance id: [dev], exec profile: []
    profile -  envVars:
    
    (*core.Cache)({
    })
    
    loading [flow ref]:  ./tests/functests/c0059-task-ref.yml
    Task1: [task ==> task:  ]
    -Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "up_runtime_task_layer_number": 0
    })
    
    cmd( 1):
    echo "step1"
    
    -
    step1
    
    -
     .. ok
    cmd( 2):
    echo "step2"
    
    -
    step2
    
    -
     .. ok
    cmd( 3):
    echo "step3"
    
    -
    step3
    
    -
     .. ok
    . ok
    -Step2:
    self: final context exec vars:
    
    (*core.Cache)({
      "last_result": (*utils.ExecResult)({
        Cmd: "echo \"step3\"",
        Code: 0,
        Output: "step3",
        ErrMsg: ""
      }),
      "up_runtime_task_layer_number": 0
    })
    
    cmd( 1):
    echo "step4"
    
    -
    step4
    
    -
     .. ok
    cmd( 2):
    echo "step5"
    
    -
    step5
    
    -
     .. ok
    cmd( 3):
    echo "step6"
    
    -
    step6
    
    -
     .. ok
    . ok
    -Step3:
    self: final context exec vars:
    
    (*core.Cache)({
      "last_result": (*utils.ExecResult)({
        Cmd: "echo \"step6\"",
        Code: 0,
        Output: "step6",
        ErrMsg: ""
      }),
      "up_runtime_task_layer_number": 0
    })
    
    cmd( 1):
    echo "step7"
    
    -
    step7
    
    -
     .. ok
    cmd( 2):
    echo "step8"
    
    -
    step8
    
    -
     .. ok
    cmd( 3):
    echo "step9"
    
    -
    step9
    
    -
     .. ok
    . ok
    
Logs with different verbose level
Raw logs with different verbose level