failFast

Showcase to use failFast flag when use assert cmd

It will report all assert results but stop there

Demo

source

Main task yaml file
    vars:
      a: global_aaa
      b: global_bbb
      c: global_ccc
      goahead: False
    #  goahead: True
    
    tasks:
    - name: task
      task:
      - func: block
        desc: show example the route goes to call goelse for the condition of not if condition
          succeeds
        vars:
          a: local_aaa
          b: local_bbb
        dvars:
        - name: da
          value: local_da
        - name: db
          value: local_db
        do:
        - func: shell
          do:
          - echo "shell step1"
          - echo "shell step2"
        - func: cmd
          vars:
            a: block_layer1_aaa
          dvars:
          - name: db
            value: local_db_layer1
          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 "block_layer1_aaa" }}'
            - '{{eq .b "local_bbb" }}'
            - '{{eq .c "global_ccc" }}'
            - '{{eq .da "local_da" }}'
            - '{{eq .db "local_db_layer1" }}'
            flags: [failFast]
        - func: shell
          do:
          - echo "shell step3"
          - echo "shell step4"
        - func: block
          desc: test embeded 2nd layer of block
          vars:
            a: local_block_layer2_aaa
            b: local_block_layer2_bbb
          dvars:
          - name: da
            value: local_da_layer2
          - name: db
            value: local_db_layer2
          do:
          - func: cmd
            vars:
              a: block_layer2_aaa
            do:
            - name: print
              cmd: |
                layer 2
                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 "block_layer2_aaa" }}'
              - '{{eq .b "local_block_layer2_bbb" }}'
              - '{{eq .c "global_ccc" }}'
              - '{{eq .da "local_da_layer2" }}'
              - '{{eq .db "local_db_layer2" }}'
              flags: [failFast]
        - func: shell
          do:
          - echo "shell step5"
          - echo "shell step6"
    
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 -> c0133
                 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/c0133
    module: [self], instance id: [dev], exec profile: []
    profile -  envVars:
    
    (*core.Cache)({
    })
    
    Task1: [task ==> task:  ]
    -Step1: [: show example the route goes to call goelse for the condition of not if condition succeeds ]
    self: final context exec vars:
    
    (*core.Cache)({
      "da": "local_da",
      "db": "local_db",
      "goahead": false,
      "a": "local_aaa",
      "b": "local_bbb",
      "c": "global_ccc",
      "up_runtime_task_layer_number": 0
    })
    
    -Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "c": "global_ccc",
      "up_runtime_task_layer_number": 0,
      "da": "local_da",
      "db": "local_db",
      "goahead": false,
      "a": "local_aaa",
      "b": "local_bbb"
    })
    
    cmd( 1):
    echo "shell step1"
    
    -
    shell step1
    
    -
     .. ok
    cmd( 2):
    echo "shell step2"
    
    -
    shell step2
    
    -
     .. ok
    . ok
    -Step2:
    self: final context exec vars:
    
    (*core.Cache)({
      "db": "local_db_layer1",
      "da": "local_da",
      "last_result": (*utils.ExecResult)({
        Cmd: "echo \"shell step2\"",
        Code: 0,
        Output: "shell step2",
        ErrMsg: ""
      }),
      "goahead": false,
      "a": "block_layer1_aaa",
      "b": "local_bbb",
      "c": "global_ccc",
      "up_runtime_task_layer_number": 0
    })
    
    ~SubStep1: [print:  ]
    layer 1
    up_runtime_task_layer_number: 0
    a: block_layer1_aaa
    b: local_bbb
    c: global_ccc
    da: local_da
    db: local_db_layer1
    
    ~SubStep2: [assert:  ]
     1 ASSERT OK:     [{{eq .a "block_layer1_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 "local_db_layer1" }}]
    -Step3:
    self: final context exec vars:
    
    (*core.Cache)({
      "b": "local_bbb",
      "c": "global_ccc",
      "last_result": (*utils.ExecResult)({
        Cmd: "echo \"shell step2\"",
        Code: 0,
        Output: "shell step2",
        ErrMsg: ""
      }),
      "goahead": false,
      "a": "local_aaa",
      "up_runtime_task_layer_number": 0,
      "da": "local_da",
      "db": "local_db"
    })
    
    cmd( 1):
    echo "shell step3"
    
    -
    shell step3
    
    -
     .. ok
    cmd( 2):
    echo "shell step4"
    
    -
    shell step4
    
    -
     .. ok
    . ok
    -Step4: [: test embeded 2nd layer of block ]
    self: final context exec vars:
    
    (*core.Cache)({
      "c": "global_ccc",
      "last_result": (*utils.ExecResult)({
        Cmd: "echo \"shell step4\"",
        Code: 0,
        Output: "shell step4",
        ErrMsg: ""
      }),
      "up_runtime_task_layer_number": 0,
      "da": "local_da_layer2",
      "db": "local_db_layer2",
      "goahead": false,
      "a": "local_block_layer2_aaa",
      "b": "local_block_layer2_bbb"
    })
    
    -Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "c": "global_ccc",
      "goahead": false,
      "a": "block_layer2_aaa",
      "b": "local_block_layer2_bbb",
      "up_runtime_task_layer_number": 0,
      "da": "local_da_layer2",
      "db": "local_db_layer2"
    })
    
    ~SubStep1: [print:  ]
    layer 2
    up_runtime_task_layer_number: 0
    a: block_layer2_aaa
    b: local_block_layer2_bbb
    c: global_ccc
    da: local_da_layer2
    db: local_db_layer2
    
    ~SubStep2: [assert:  ]
     1 ASSERT OK:     [{{eq .a "block_layer2_aaa" }}]
     2 ASSERT OK:     [{{eq .b "local_block_layer2_bbb" }}]
     3 ASSERT OK:     [{{eq .c "global_ccc" }}]
     4 ASSERT OK:     [{{eq .da "local_da_layer2" }}]
     5 ASSERT OK:     [{{eq .db "local_db_layer2" }}]
    -Step5:
    self: final context exec vars:
    
    (*core.Cache)({
      "db": "local_db",
      "a": "local_aaa",
      "b": "local_bbb",
      "c": "global_ccc",
      "goahead": false,
      "up_runtime_task_layer_number": 0,
      "da": "local_da"
    })
    
    cmd( 1):
    echo "shell step5"
    
    -
    shell step5
    
    -
     .. ok
    cmd( 2):
    echo "shell step6"
    
    -
    shell step6
    
    -
     .. ok
    . ok
    
Logs with different verbose level
Raw logs with different verbose level