- job:
    name: lite-aeolus-openamp
    project-type: matrix
    defaults: global
    properties:
        - authorization:
            anonymous:
                - job-read
                - job-extended-read
                - job-workspace
            everyone-flat:
                - job-read
                - job-extended-read
                - job-build
                - job-cancel
        - build-discarder:
            days-to-keep: 30
            num-to-keep: 30
            artifact-num-to-keep: 30
    parameters:
        - string:
            name: GIT_URL
            default: 'https://github.com/OpenAMP/libmetal'
        - string:
            name: BRANCH
            default: 'master'
        - string:
            name: ZEPHYR_GIT_URL
            default: 'https://github.com/zephyrproject-rtos/zephyr'
        - string:
            name: ZEPHYR_BRANCH
            default: 'master'
        - string:
            name: LAVA_SERVER
            default: 'validation.linaro.org/RPC2/'
        - string:
            name: QA_SERVER
            default: 'https://qa-reports.linaro.org'
        - string:
            name: QA_SERVER_GROUP
            default: 'lite'
        - string:
            name: QA_SERVER_PROJECT
            default: 'openamp'
        - string:
            name: USE_QA_SERVER
            default: '1'
        # Normally we just pull to existing repo checkouts, but can re-clone
        # from scratch with this setting.
        - string:
            name: GIT_RECLONE
            default: '0'
    disabled: true
    node: master
    child-workspace: .
    display-name: 'DELETE ME'
    axes:
        - axis:
            type: slave
            name: label
            values:
                - x86_64-13
        - axis:
            type: user-defined
            name: ZEPHYR_TOOLCHAIN_VARIANT
            values:
                - zephyr
        - axis:
            type: user-defined
            name: PLATFORM
            values:
                - qemu_xilinx
    wrappers:
        - timestamps
        - credentials-binding:
            - text:
                credential-id: LAVA_USER
                variable: LAVA_USER
        - credentials-binding:
            - text:
                credential-id: LAVA_TOKEN
                variable: LAVA_TOKEN
        - credentials-binding:
            - text:
                credential-id: QA_REPORTS_TOKEN
                variable: QA_REPORTS_TOKEN
    builders:
        - shell: |
            rm -rf job-configs
            git clone --depth 1 http://git.linaro.org/ci/job/configs.git job-configs
        - shell: |
            ./job-configs/lite-aeolus-openamp/install-deps-nonroot.sh
        - shell: |
            ./job-configs/lite-aeolus-openamp/build.sh
        - inject:
            properties-file: env_var_parameters
        - build-name-setter:
            template: '#${BUILD_NUMBER}-${GIT_COMMIT}'
            macro: true
        - linaro-publish-token
        - shell: |
            #!/bin/bash

            echo "Publishing artifacts"

            # Publish. Need to publish out of a directory to make files publicly accessible.
            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
            time python ${HOME}/bin/linaro-cp.py \
              --api_version 3 \
              --link-latest \
              out/ components/kernel/aeolus-2/openamp/${BRANCH}/${PLATFORM}/${BUILD_NUMBER}

            rm -rf out
        - shell: |
            rm -rf lite-build-tools
            git clone --depth 1 https://github.com/pfalcon/lite-build-tools
            ./job-configs/lite-aeolus-openamp/submit-test.sh

    publishers:
        - groovy-postbuild:
            script:
                !include-raw: lite-aeolus/description-lava-link.groovy
#        - email:
#            recipients: 'ed.mooring@linaro.org'
