github.com/upcmd/up@v0.8.1-0.20230108151705-ad8b797bf04f/tests/functests/c0131.yml (about) 1 doc_meta: | 2 folder: flow-controll 3 title: else with a flow 4 head: | 5 Showcase that you could use a flow of a serial of steps in else branch。 In this case, you don not have to route the logic to a external task 6 7 sections: 8 - title: Demo 9 log: yes 10 11 vars: 12 goahead: False 13 # goahead: True 14 15 tasks: 16 17 - name: task 18 task: 19 20 - func: cmd 21 do: 22 - 23 name: print 24 cmd: | 25 true/false value of goahead: 26 {{.goahead}} 27 {{not .goahead}} 28 29 - func: call 30 desc: show use a flow in else 31 do: 32 - goahead 33 if: '{{.goahead}}' 34 else: 35 - func: cmd 36 do: 37 - 38 name: print 39 cmd: 'do something else step1 .......' 40 - func: shell 41 do: 42 - echo do something else step2 ....... 43 - func: cmd 44 do: 45 - 46 name: print 47 cmd: 'do something else step3 .......' 48 49 - func: call 50 desc: show it is same that you could assemble a list of tasks for if true condition 51 vars: 52 goahead: True 53 do: 54 - goelse 55 56 - name: goahead 57 task: 58 - func: cmd 59 do: 60 - 61 name: print 62 cmd: 'go ahead .......' 63 64 - name: goelse 65 task: 66 - func: cmd 67 do: 68 - 69 name: print 70 cmd: 'do something else .......'