github.com/upcmd/up@v0.8.1-0.20230108151705-ad8b797bf04f/tests/functests/c0129.yml (about) 1 doc_meta: | 2 folder: block-func 3 title: embeded block 4 head: | 5 This demo shows that block func could be embeded in multiple layers 6 7 sections: 8 - title: block could be embeded to be multiple layers 9 content: | 10 Please notice that the values printed out in different funcs in different layer, they will inherit and override the vars from parent block func level 11 12 - title: Demo 13 log: yes 14 15 notes: 16 goal: 17 - test override and merge in block func 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 vars: 46 a: block_layer1_aaa 47 do: 48 - 49 name: print 50 cmd: | 51 layer 1 52 up_runtime_task_layer_number: {{.up_runtime_task_layer_number}} 53 a: {{.a}} 54 b: {{.b}} 55 c: {{.c}} 56 da: {{.da}} 57 db: {{.db}} 58 59 - func: shell 60 do: 61 - echo "shell step3" 62 - echo "shell step4" 63 64 - func: block 65 desc: test embeded 2nd layer of block 66 vars: 67 a: local_block_layer2_aaa 68 b: local_block_layer2_bbb 69 dvars: 70 - name: da 71 value: local_da_layer2 72 - name: db 73 value: local_db_layer2 74 do: 75 - func: cmd 76 vars: 77 a: block_layer2_aaa 78 do: 79 - 80 name: print 81 cmd: | 82 layer 2 83 up_runtime_task_layer_number: {{.up_runtime_task_layer_number}} 84 a: {{.a}} 85 b: {{.b}} 86 c: {{.c}} 87 da: {{.da}} 88 db: {{.db}} 89 90 - func: shell 91 do: 92 - echo "shell step5" 93 - echo "shell step6"