github.com/upcmd/up@v0.8.1-0.20230108151705-ad8b797bf04f/tests/modtests/wip/module/up.yml (about)

     1  
     2  tasks:
     3    -
     4      name: Main
     5      desc: main entry
     6      task:
     7        -
     8          func: shell
     9          desc: main job
    10          do:
    11            - echo "hello world"
    12  
    13        -
    14          func: call
    15          desc: |
    16            internal test without input arg
    17          do:
    18            - HttpGet
    19  
    20        -
    21          func: cmd
    22          do:
    23            - name: print
    24              cmd: 'caller1 -> {{.http_response}}'
    25  
    26        -
    27          func: call
    28          desc: |
    29            internal test with input arg
    30          vars:
    31            endpoint: https://httpbin.org/get
    32          do:
    33            - HttpGet
    34  
    35        -
    36          func: cmd
    37          do:
    38            - name: print
    39              cmd: 'caller2 -> {{.http_response}}'
    40  
    41    -
    42      name: HttpGet
    43      task:
    44        -
    45          func: shell
    46          vars:
    47            endpoint: http://example.org
    48          do:
    49            - 'curl -s -X GET "{{.endpoint}}" -H "accept: application/json"'
    50          reg: get_result
    51  
    52        -
    53          func: cmd
    54          dvars:
    55            - name: http_response
    56              value: '{{.get_result.Output}}'
    57          do:
    58            - name: print
    59              cmd: '{{.get_result.Output}}'
    60            - name: return
    61              cmd:
    62                - http_response
    63  
    64