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

     1  doc_meta: |
     2    folder: quick-start
     3    title: call func (power up)
     4    weight: 152
     5    head: |
     6      The callee task is reprented using a var name make it dynamic in execution time
     7  
     8    sections:
     9      - title: Demo
    10        log: yes
    11  
    12      - title: How it works?
    13        content: the task call pointing to a var name extra_task_name is routed to post_task task
    14  
    15      - title: Prerequisites
    16        content: Understanding of basics of vars
    17        refs:
    18          - title: vars basics
    19            link: ../../vars/c0012
    20  
    21  notes:
    22    goal:
    23      - to ues call to achieve the goal of task composition
    24    why:
    25      - it is like dep but allow pre and post task using call
    26  
    27  vars:
    28    extra_task_name: post_task
    29  
    30  tasks:
    31    -
    32      name: pre_task
    33      desc: this is pre-task
    34      task:
    35        -
    36          func: shell
    37          do:
    38            - echo "hello"
    39  
    40    -
    41      name: post_task
    42      desc: this is post-task
    43      task:
    44        -
    45          func: shell
    46          desc: do step1 in shell func
    47          do:
    48            - echo "world"
    49  
    50    -
    51      name: 2ndtask
    52      task:
    53        -
    54          func: shell
    55          desc: to test multiple refs
    56          do:
    57            - echo "this is 2nd task"
    58  
    59    -
    60      name: task
    61      desc: this is the task and expect the final message (hello I love this world)
    62      task:
    63        -
    64          func: shell
    65          do:
    66            - echo " I love this "
    67        -
    68          func: call
    69          desc: use a dynamic var to refer to a task name
    70          do:
    71            - '{{.extra_task_name}}'
    72            - 2ndtask