github.com/chenbh/concourse/v6@v6.4.2/testflight/fixtures/optional-inputs.yml (about)

     1  ---
     2  jobs:
     3  - name: job-using-optional-inputs
     4    plan:
     5    - task: task-generate-data
     6      config:
     7        platform: linux
     8        image_resource:
     9          type: mock
    10          source: {mirror_self: true}
    11        outputs:
    12        - name: some-data
    13        run:
    14          path: sh
    15          args:
    16          - -c
    17          - |
    18            set -euxo pipefail
    19            echo "banana" > some-data/foo
    20            echo "step 1 complete: generated some required data"
    21    - task: task-missing-optional-input
    22      input_mapping:
    23        required-input: some-data
    24      config:
    25        platform: linux
    26        image_resource:
    27          type: mock
    28          source: {mirror_self: true}
    29        inputs:
    30        - name: required-input
    31        - name: optional-input
    32          optional: true
    33        run:
    34          path: sh
    35          args:
    36          - -c
    37          - |
    38            set -euxo pipefail
    39            ls
    40            cat required-input/foo
    41            if [ -d optional-input ] ; then
    42              echo "error: optional-input should not be present"
    43              exit 1
    44            fi
    45            echo "step 2 complete: tolerates missing optional inputs"
    46    - task: task-with-mapped-optional-input
    47      input_mapping:
    48        required-input: some-data
    49        optional-input: some-data
    50      config:
    51        platform: linux
    52        image_resource:
    53          type: mock
    54          source: {mirror_self: true}
    55        inputs:
    56        - name: required-input
    57        - name: optional-input
    58          optional: true
    59        run:
    60          path: sh
    61          args:
    62          - -e
    63          - -c
    64          - |
    65            set -euxo pipefail
    66            ls
    67            cat required-input/foo
    68            cat optional-input/foo  # should exist now
    69            echo "step 3 complete: sees mapped optional inputs"
    70            echo "SUCCESS"