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

     1  doc_meta: |
     2    folder: vars
     3    title: Use variables
     4    head: |
     5      You can define variables in your UP global context, which means the vars element is a root element of the yml file
     6  
     7      In your func implementation(it is a shell in this case), you can reference this var using golang template syntax
     8  
     9    sections:
    10      - title: Demo
    11        log: yes
    12  
    13      - title: How it works?
    14        content: hello {{.a}} will print out the actual value 'runtime-a'
    15  
    16      - title: Prerequisites
    17        content: Understanding of basics usage of golang template
    18  
    19  notes:
    20    goal:
    21      - to test empty vars in func will pass
    22  
    23  vars:
    24    a: runtime-a
    25    e: runtime-e
    26    k: runtime-k
    27  
    28  tasks:
    29  
    30    -
    31      name: task
    32      task:
    33        -
    34          func: shell
    35          desc: to test display env vars from shell context
    36          do:
    37            - echo "hello, world"
    38            - echo 'hello {{.a}}'