###################################
# job configuration for yardstick
###################################
- project:
    name: yardstick

    project: '{name}'

#--------------------------------
# BRANCH ANCHORS
#--------------------------------
    master: &master
        stream: master
        branch: '{stream}'
        gs-pathname: ''
        docker-tag: 'latest'
    colorado: &colorado
        stream: colorado
        branch: 'stable/{stream}'
        gs-pathname: '{stream}'
        docker-tag: 'stable'
#--------------------------------
# POD, INSTALLER, AND BRANCH MAPPING
#--------------------------------
#    Installers using labels
#            CI PODs
# This section should only contain the installers
# that have been switched using labels for slaves
#--------------------------------
    pod:
# fuel CI PODs
        - baremetal:
            slave-label: fuel-baremetal
            installer: fuel
            auto-trigger-name: 'daily-trigger-disabled'
            <<: *master
        - virtual:
            slave-label: fuel-virtual
            installer: fuel
            auto-trigger-name: 'daily-trigger-disabled'
            <<: *master
        - baremetal:
            slave-label: fuel-baremetal
            installer: fuel
            auto-trigger-name: 'daily-trigger-disabled'
            <<: *colorado
        - virtual:
            slave-label: fuel-virtual
            installer: fuel
            auto-trigger-name: 'daily-trigger-disabled'
            <<: *colorado
# armband CI PODs
        - armband-baremetal:
            slave-label: armband-baremetal
            installer: fuel
            auto-trigger-name: 'daily-trigger-disabled'
            <<: *master
        - armband-virtual:
            slave-label: armband-virtual
            installer: fuel
            auto-trigger-name: 'daily-trigger-disabled'
            <<: *master
        - armband-baremetal:
            slave-label: armband-baremetal
            installer: fuel
            auto-trigger-name: 'daily-trigger-disabled'
            <<: *colorado
        - armband-virtual:
            slave-label: armband-virtual
            installer: fuel
            auto-trigger-name: 'daily-trigger-disabled'
            <<: *colorado
# joid CI PODs
        - baremetal:
            slave-label: joid-baremetal
            installer: joid
            auto-trigger-name: 'daily-trigger-disabled'
            <<: *master
        - virtual:
            slave-label: joid-virtual
            installer: joid
            auto-trigger-name: 'daily-trigger-disabled'
            <<: *master
        - baremetal:
            slave-label: joid-baremetal
            installer: joid
            auto-trigger-name: 'daily-trigger-disabled'
            <<: *colorado
        - virtual:
            slave-label: joid-virtual
            installer: joid
            auto-trigger-name: 'daily-trigger-disabled'
            <<: *colorado

# compass CI PODs
        - baremetal:
            slave-label: compass-baremetal
            installer: compass
            auto-trigger-name: 'daily-trigger-disabled'
            <<: *master
        - virtual:
            slave-label: compass-virtual
            installer: compass
            auto-trigger-name: 'daily-trigger-disabled'
            <<: *master
        - baremetal:
            slave-label: compass-baremetal
            installer: compass
            auto-trigger-name: 'daily-trigger-disabled'
            <<: *colorado
        - virtual:
            slave-label: compass-virtual
            installer: compass
            auto-trigger-name: 'daily-trigger-disabled'
            <<: *colorado
#--------------------------------
#    Installers not using labels
#            CI PODs
# This section should only contain the installers
# that have not been switched using labels for slaves
#--------------------------------
        - lf-pod1:
            slave-label: '{pod}'
            installer: apex
            auto-trigger-name: 'daily-trigger-disabled'
            <<: *master
        - lf-pod1:
            slave-label: '{pod}'
            installer: apex
            auto-trigger-name: 'daily-trigger-disabled'
            <<: *colorado
#--------------------------------
#        None-CI PODs
#--------------------------------
        - orange-pod1:
            slave-label: '{pod}'
            installer: joid
            auto-trigger-name: 'daily-trigger-disabled'
            <<: *master
        - zte-pod1:
            slave-label: '{pod}'
            installer: fuel
            auto-trigger-name: 'daily-trigger-disabled'
            <<: *master
        - zte-pod1:
            slave-label: '{pod}'
            installer: fuel
            auto-trigger-name: 'daily-trigger-disabled'
            <<: *colorado
        - zte-pod2:
            slave-label: '{pod}'
            installer: fuel
            auto-trigger-name: 'daily-trigger-disabled'
            <<: *master
        - zte-pod3:
            slave-label: '{pod}'
            installer: fuel
            auto-trigger-name: 'daily-trigger-disabled'
            <<: *master
        - zte-pod3:
            slave-label: '{pod}'
            installer: fuel
            auto-trigger-name: 'daily-trigger-disabled'
            <<: *colorado
        - arm-pod2:
            slave-label: '{pod}'
            installer: fuel
            auto-trigger-name: 'daily-trigger-disabled'
            <<: *master
        - arm-pod2:
            slave-label: '{pod}'
            installer: fuel
            auto-trigger-name: 'daily-trigger-disabled'
            <<: *colorado
        - arm-pod3:
            slave-label: '{pod}'
            installer: fuel
            auto-trigger-name: 'daily-trigger-disabled'
            <<: *master
        - arm-pod3:
            slave-label: '{pod}'
            installer: fuel
            auto-trigger-name: 'daily-trigger-disabled'
            <<: *colorado
        - orange-pod2:
            slave-label: '{pod}'
            installer: joid
            auto-trigger-name: 'daily-trigger-disabled'
            <<: *master
        - huawei-pod3:
            slave-label: '{pod}'
            installer: compass
            auto-trigger-name: 'yardstick-daily-huawei-pod3-trigger'
            <<: *master
        - huawei-pod4:
            slave-label: '{pod}'
            installer: compass
            auto-trigger-name: 'yardstick-daily-huawei-pod4-trigger'
            <<: *master
        - huawei-pod5:
            slave-label: '{pod}'
            installer: compass
            auto-trigger-name: 'daily-trigger-disabled'
            <<: *master
#--------------------------------
    testsuite:
        - 'daily'

    jobs:
        - 'yardstick-{installer}-{pod}-{testsuite}-{stream}'

################################
# job templates
################################
- job-template:
    name: 'yardstick-{installer}-{pod}-{testsuite}-{stream}'

    disabled: false

    concurrent: true

    properties:
        - throttle:
            enabled: true
            max-per-node: 1
            option: 'project'

    wrappers:
        - build-name:
            name: '$BUILD_NUMBER - Scenario: $DEPLOY_SCENARIO'
        - timeout:
            timeout: 180
            abort: true

    triggers:
        - '{auto-trigger-name}'

    parameters:
        - project-parameter:
            project: '{project}'
        - gerrit-parameter:
            branch: '{branch}'
        - '{installer}-defaults'
        - '{slave-label}-defaults'
        - 'yardstick-params-{slave-label}'
        - string:
            name: DEPLOY_SCENARIO
            default: 'os-odl_l2-nofeature-ha'
        - string:
            name: DOCKER_TAG
            default: '{docker-tag}'
            description: 'Tag to pull docker image'
        - string:
            name: YARDSTICK_SCENARIO_SUITE_NAME
            default: opnfv_${{DEPLOY_SCENARIO}}_{testsuite}.yaml
            description: 'Path to test scenario suite'
        - string:
            name: CI_DEBUG
            default: 'false'
            description: "Show debut output information"

    scm:
        - git-scm

    builders:
        - description-setter:
            description: "POD: $NODE_NAME"
        - 'yardstick-cleanup'
        #- 'yardstick-fetch-os-creds'
        - 'yardstick-{testsuite}'

    publishers:
        - email:
            recipients: jean.gaoliang@huawei.com matthew.lijun@huawei.com

########################
# builder macros
########################
- builder:
    name: yardstick-daily
    builders:
        - shell:
            !include-raw: ./yardstick-daily.sh

- builder:
    name: yardstick-vtcdaily
    builders:
        - shell:
            !include-raw: ./yardstick-vtcdaily.sh

- builder:
    name: yardstick-fetch-os-creds
    builders:
        - shell:
            !include-raw: ../../utils/fetch_os_creds.sh

- builder:
    name: yardstick-cleanup
    builders:
        - shell:
            !include-raw: ./yardstick-cleanup.sh
########################
# parameter macros
########################
- parameter:
    name: 'yardstick-params-fuel-baremetal'
    parameters:
        - string:
            name: YARDSTICK_DB_BACKEND
            default: '-i 104.197.68.199:8086'
            description: 'Arguments to use in order to choose the backend DB'
- parameter:
    name: 'yardstick-params-fuel-virtual'
    parameters:
        - string:
            name: YARDSTICK_DB_BACKEND
            default: '-i 104.197.68.199:8086'
            description: 'Arguments to use in order to choose the backend DB'
- parameter:
    name: 'yardstick-params-armband-baremetal'
    parameters:
        - string:
            name: YARDSTICK_DB_BACKEND
            default: '-i 104.197.68.199:8086'
            description: 'Arguments to use in order to choose the backend DB'
- parameter:
    name: 'yardstick-params-armband-virtual'
    parameters:
        - string:
            name: YARDSTICK_DB_BACKEND
            default: '-i 104.197.68.199:8086'
            description: 'Arguments to use in order to choose the backend DB'
- parameter:
    name: 'yardstick-params-joid-baremetal'
    parameters:
        - string:
            name: YARDSTICK_DB_BACKEND
            default: '-i 104.197.68.199:8086'
            description: 'Arguments to use in order to choose the backend DB'
- parameter:
    name: 'yardstick-params-joid-virtual'
    parameters:
        - string:
            name: YARDSTICK_DB_BACKEND
            default: '-i 104.197.68.199:8086'
            description: 'Arguments to use in order to choose the backend DB'
- parameter:
    name: 'yardstick-params-intel-pod8'
    parameters:
        - string:
            name: YARDSTICK_DB_BACKEND
            default: '-i 104.197.68.199:8086'
            description: 'Arguments to use in order to choose the backend DB'
- parameter:
    name: 'yardstick-params-lf-pod1'
    parameters:
        - string:
            name: YARDSTICK_DB_BACKEND
            default: '-i 104.197.68.199:8086'
            description: 'Arguments to use in order to choose the backend DB'

- parameter:
    name: 'yardstick-params-lf-pod2'
    parameters:
        - string:
            name: YARDSTICK_DB_BACKEND
            default: '-i 104.197.68.199:8086'
            description: 'Arguments to use in order to choose the backend DB'

- parameter:
    name: 'yardstick-params-compass-baremetal'
    parameters:
        - string:
            name: YARDSTICK_DB_BACKEND
            default: '-i 104.197.68.199:8086'
            description: 'Arguments to use in order to choose the backend DB'

- parameter:
    name: 'yardstick-params-huawei-pod5'
    parameters:
        - string:
            name: YARDSTICK_DB_BACKEND
            default: '-i 104.197.68.199:8086'
            description: 'Arguments to use in order to choose the backend DB'

- parameter:
    name: 'yardstick-params-zte-pod1'
    parameters:
        - string:
            name: YARDSTICK_DB_BACKEND
            default: '-i 104.197.68.199:8086'
            description: 'Arguments to use in order to choose the backend DB'

- parameter:
    name: 'yardstick-params-zte-pod2'
    parameters:
        - string:
            name: YARDSTICK_DB_BACKEND
            default: '-i 104.197.68.199:8086'
            description: 'Arguments to use in order to choose the backend DB'

- parameter:
    name: 'yardstick-params-zte-pod3'
    parameters:
        - string:
            name: YARDSTICK_DB_BACKEND
            default: '-i 104.197.68.199:8086'
            description: 'Arguments to use in order to choose the backend DB'

- parameter:
    name: 'yardstick-params-orange-pod1'
    parameters:
        - string:
            name: YARDSTICK_DB_BACKEND
            default: '-i 104.197.68.199:8086'
            description: 'Arguments to use in order to choose the backend DB'

- parameter:
    name: 'yardstick-params-orange-pod2'
    parameters:
        - string:
            name: YARDSTICK_DB_BACKEND
            default: '-i 104.197.68.199:8086'
            description: 'Arguments to use in order to choose the backend DB'

- parameter:
    name: 'yardstick-params-arm-pod2'
    parameters:
        - string:
            name: YARDSTICK_DB_BACKEND
            default: '-i 104.197.68.199:8086'
            description: 'Arguments to use in order to choose the backend DB'

- parameter:
    name: 'yardstick-params-arm-pod3'
    parameters:
        - string:
            name: YARDSTICK_DB_BACKEND
            default: '-i 104.197.68.199:8086'
            description: 'Arguments to use in order to choose the backend DB'

- parameter:
    name: 'yardstick-params-virtual'
    parameters:
        - string:
            name: YARDSTICK_DB_BACKEND
            default: '-i 104.197.68.199:8086'
            description: 'Arguments to use in order to choose the backend DB'

- parameter:
    name: 'yardstick-params-compass-virtual'
    parameters:
        - string:
            name: YARDSTICK_DB_BACKEND
            default: '-i 104.197.68.199:8086'
            description: 'Arguments to use in order to choose the backend DB'

- parameter:
    name: 'yardstick-params-huawei-pod3'
    parameters:
        - string:
            name: YARDSTICK_DB_BACKEND
            default: '-i 104.197.68.199:8086'
            description: 'Arguments to use in order to choose the backend DB'

- parameter:
    name: 'yardstick-params-huawei-pod4'
    parameters:
        - string:
            name: YARDSTICK_DB_BACKEND
            default: '-i 104.197.68.199:8086'
            description: 'Arguments to use in order to choose the backend DB'

#######################
## trigger macros
#######################
# trigger for PODs to only run yardstick test suites
- trigger:
    name: 'yardstick-daily-huawei-pod3-trigger'
    triggers:
        - timed: '0 1 * * *'

- trigger:
    name: 'yardstick-daily-huawei-pod4-trigger'
    triggers:
        - timed: '0 1 * * *'