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

     1  doc_meta: |
     2    folder: organization
     3    title: use case 1
     4    head: |
     5      Showcase gradually the lengthy configuration evolve to simpler skeleton by using ref element to externalized task/flow. Please also checkout the changes of: use case 2
     6  
     7    sections:
     8      - title: Externalized the task definition - c0060-task-ref.yml
     9        filelookup: c0060-task-ref.yml
    10  
    11      - title: Flow element
    12        content: |
    13          Introduce the flow element to notate a task reference
    14  
    15          With ref element in main tasks file, this will make the entry point much cleaner and the main skeleton design stand out
    16  
    17  
    18      - title: Demo
    19        log: yes
    20  
    21  notes:
    22    goal:
    23      - show a little bit more complicated use case with chained tasks and externalised tasks
    24      - show how to use condition(basics)
    25      - show how to use loop(basics)
    26      - for details of condition/loop, check the comphensive case of them separately
    27  
    28  vars:
    29    student_name: tom
    30    classes: [1k,2b,3j,4s]
    31  
    32  tasks:
    33  
    34    -
    35      name: task
    36      task:
    37        -
    38          func: shell
    39          do:
    40            - echo "task step 1"
    41            - echo "task step 2"
    42  
    43        -
    44          func: call
    45          do:
    46            - task_a
    47            - task_c
    48            - task_a
    49          if: '{{eq .student_name "tom"}}'
    50  
    51        -
    52          func: call
    53          do:
    54            - task_b
    55          loop: "classes"
    56          if: '{{eq .student_name "tom"}}'
    57  
    58        -
    59          func: shell
    60          do:
    61            - echo "task step 3"
    62            - echo "task step 4"
    63  
    64        -
    65          func: call
    66          do:
    67            - a_very_complicated_task
    68  
    69    -
    70      name: task_a
    71      task:
    72        -
    73          func: shell
    74          do:
    75            - echo "task_a_step1"
    76    -
    77      name: task_c
    78      task:
    79        -
    80          func: shell
    81          do:
    82            - echo "task_c_step1"
    83  
    84    -
    85      name: task_b
    86      task:
    87        -
    88          func: shell
    89          do:
    90            - echo "task_b_step1"
    91            - echo "{{.loopindex}} -> student nameed {{.student_name}} has been in class [{{.loopitem}}]"
    92  
    93    -
    94      name: a_very_complicated_task
    95      desc: "a_very_complicated_task"
    96      ref: c0060-task-ref.yml