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

     1  doc_meta: |
     2    folder: dvars
     3    title: dvars in scopes
     4    head: |
     5      Similarly to the process that vars loading sequence, dvars in scopes follow the same sequence to be loaded from global group, then group, then instance id, then runtime global, then local scope in func
     6  
     7    sections:
     8  
     9      - title: Demo
    10        log: yes
    11  
    12  notes:
    13    goal:
    14      - to test out dvars rendering in scope
    15      - it loads global vars first, then render dvars and merge it with vars in global scope
    16      - it then merge nonprod vars to global as runtimevars, then
    17      - render dvars based on runtimevars, then
    18      - continue same idea down to individual runtime intance vars/dvars process
    19  
    20    expected:
    21      cmd1: da -> global-a
    22      cmd2: dab -> global-a-and-global-b
    23      cmd3: non-prod-a
    24  
    25  scopes:
    26    -
    27      name: global
    28      vars:
    29        a: global-a
    30        b: global-b
    31        c: global-c
    32        e: global-e
    33      dvars:
    34        - name: da
    35          value: "{{.a}}"
    36        - name: dab
    37          value: "{{.a}}-and-{{.b}}"
    38  
    39    -
    40      name: nonprod
    41      members:
    42        - dev
    43        - staging
    44      vars:
    45        a: non-prod-a
    46        b: non-prod-b
    47        c: non-prod-c
    48        d: non-prod-d
    49      dvars:
    50        - name: dvar_np_a
    51          value: "{{.a}}"
    52        - name: dab
    53          value: "{{.a}}-and-{{.b}}"
    54  
    55    -
    56      name: staging
    57      vars:
    58        a: staging-a
    59        b: staging-b
    60  
    61  tasks:
    62  
    63    -
    64      name: task
    65      task:
    66        -
    67          func: shell
    68          do:
    69            - echo "cmd1:da -> {{.da}}"
    70            - echo "cmd2:dab -> {{.dab}}"
    71            - echo "cmd3:{{.dvar_np_a}}"