github.com/upcmd/up@v0.8.1-0.20230108151705-ad8b797bf04f/tests/functests/c0091.yml (about)

     1  doc_meta: |
     2    folder: loop
     3    title: multi-layers loop 1
     4    head: |
     5      This case demos 3 layers of loop to show the loopitem in each layer is from parent and the callee will inherit all vars/dvars from caller chain through to the root caller
     6  
     7    sections:
     8      - title: Demo
     9        log: yes
    10  
    11  tasks:
    12  
    13    - name: task
    14      task:
    15  
    16        - func: call
    17          vars:
    18            layer1_aaa: layer1_aaa
    19            layer1_bbb: layer1_bbb
    20  
    21          do:
    22            - layer2
    23          loop:
    24            - layer1-tom
    25            - layer1-peter
    26            - layer1-james
    27  
    28    - name: layer2
    29      task:
    30        - func: cmd
    31          do:
    32            -
    33              name: print
    34              cmd: 'hello {{.loopitem}}'
    35  
    36            -
    37              name: print
    38              cmd: 'hello layer1_aaa: {{.layer1_aaa}}'
    39  
    40        - func: call
    41          vars:
    42            layer2_aaa: layer2_aaa
    43            layer2_bbb: layer2_bbb
    44          do:
    45            - layer3
    46          loop:
    47            - layer2-tom
    48            - layer2-peter
    49            - layer2-james
    50  
    51    - name: layer3
    52      task:
    53        - func: cmd
    54          do:
    55            -
    56              name: print
    57              cmd: 'hello {{.loopitem}}'
    58            -
    59              name: print
    60              cmd: 'hello layer1_aaa: {{.layer1_aaa}}'
    61            -
    62              name: print
    63              cmd: 'hello layer2_aaa: {{.layer2_aaa}}'