github.com/upcmd/up@v0.8.1-0.20230108151705-ad8b797bf04f/tests/functests/c0128.yml (about) 1 doc_meta: | 2 folder: block-func 3 title: use block 4 head: | 5 Block func is introduced for an alternative coding style to mainly deal with internal business. Call func mainly serves to offer interoperability and sharing and exchanging code with different projects/teams, block func in the oposite, it allows your code to share the same vars stack as long as your func is in one of the leave level in tree of a block 6 7 sections: 8 - title: Vars inherit from block func vars and auto merge 9 content: | 10 Please notice that the values printed out in print cmd in the flow of steps in block func, the vars: a, b, da, db will inherit the values defined in vars in block func 11 12 - title: Demo 13 log: yes 14 15 notes: 16 goal: 17 - add feature to support block code style 18 19 vars: 20 a: global_aaa 21 b: global_bbb 22 c: global_ccc 23 24 tasks: 25 - name: task 26 task: 27 28 - func: block 29 desc: show example the route goes to call goelse for the condition of not if condition succeeds 30 vars: 31 a: local_aaa 32 b: local_bbb 33 dvars: 34 - name: da 35 value: local_da 36 - name: db 37 value: local_db 38 do: 39 - func: shell 40 do: 41 - echo "shell step1" 42 - echo "shell step2" 43 44 - func: cmd 45 do: 46 - 47 name: print 48 cmd: | 49 cmd print step 50 up_runtime_task_layer_number: {{.up_runtime_task_layer_number}} 51 a: {{.a}} 52 b: {{.b}} 53 da: {{.da}} 54 db: {{.db}}