github.com/swaros/contxt/module/runner@v0.0.0-20240305083542-3dbd4436ac40/testdata/issues/issue_185/.contxt.yml (about)

     1  config:
     2    variables:
     3      CFG_USER: "test"
     4    imports:
     5       - default.yml local-config
     6       
     7  task:
     8    - id: local-config
     9      require:
    10        system: linux
    11        exists:
    12          - ${CFG_USER}.local.json
    13      script:
    14        - echo "loading local config file from user ${CFG_USER}.local.json"
    15        - "#@import-json-exec local-config cat ${CFG_USER}.local.json"
    16  
    17    - id: build-base-image
    18      needs:
    19        - local-config
    20      script:
    21        - echo "testing vars"
    22        - "#@set RUNCMD --build-arg CMP_KEYID=${local-config:HIDDEN.CMP_KEYID}"
    23        - "#@set RUNCMD ${RUNCMD} --build-arg CMP_ACID=${local-config:HIDDEN.CMP_ACID}"
    24        - "#@set RUNCMD ${RUNCMD} --build-arg LICENCE_KEY=${local-config:HIDDEN.LICENCE_KEY}"
    25        - echo "${RUNCMD}"
    26  
    27    - id: test-actual-user
    28      needs:
    29        - local-user-config
    30      script:
    31        - echo "you are [${USER}]"
    32  
    33    - id: local-user-config
    34      require:
    35        system: linux
    36        exists:
    37          - ${USER}.local.json
    38      script:
    39        - echo "this should not being executed because  ${USER}.local.json should not exist"
    40  
    41    - id: local-user-config
    42      require:
    43        system: linux
    44        notExists:
    45          - ${USER}.local.json
    46      script:
    47        - echo "not loading local config file from user ${USER}.local.json"