- job:
    name: systems-diagnostics-linarocp
    project-type: freestyle
    defaults: global
    properties:
        - authorization:
            anonymous:
                - job-discover
            everyone-flat:
                - job-build
                - job-read
                - job-extended-read
                - job-workspace
        - build-discarder:
            days-to-keep: 5
            num-to-keep: 10
    disabled: false
    node: docker-focal-amd64
    display-name: 'Systems Diagnostics - linaro-cp'

    wrappers:
        - timestamps
        - timeout:
            timeout: 500
        # needed to publish to snapshots
        - credentials-binding:
            - text:
                credential-id: snapshots-api-key
                variable: PUBLISH_KEY

    builders:
        - shell: |

            NOW=$(date +%Y-%m-%d)
            mkdir -p ./systems-test/$NOW
            echo "hello" > systems-test/$NOW/hello.txt

            # Publish
            test -d ${HOME}/bin || mkdir ${HOME}/bin
            wget -q https://git.linaro.org/ci/publishing-api.git/blob_plain/HEAD:/linaro-cp.py -O ${HOME}/bin/linaro-cp.py
            # --server defaults to https://snapshots.linaro.org
            # Should pull in credential from $PUBLISH_KEY set in bindings above
            time python3 ${HOME}/bin/linaro-cp.py \
              --api_version 3 \
              systems-test/$NOW test/$NOW
 
    publishers:
        - email:
            recipients: 'kelley.spoon@linaro.org'
