# jenkins job templates for Armband
- project:
    name: 'armband-ci'
    project: 'armband'

#--------------------------------
# BRANCH ANCHORS
#--------------------------------
    master: &master
        stream: master
        branch: '{stream}'
        gs-pathname: ''
    colorado: &colorado
        stream: colorado
        branch: 'stable/{stream}'
        gs-pathname: '/{stream}'
#--------------------------------
# POD, INSTALLER, AND BRANCH MAPPING
#--------------------------------
# CI POD's
#--------------------------------
#        colorado
#--------------------------------
    pod:
        - armband-baremetal:
            slave-label: armband-baremetal
            installer: fuel
            <<: *colorado
        - armband-virtual:
            slave-label: armband-virtual
            installer: fuel
            <<: *colorado
#--------------------------------
#        master
#--------------------------------
        - armband-baremetal:
            slave-label: armband-baremetal
            installer: fuel
            <<: *master
        - armband-virtual:
            slave-label: armband-virtual
            installer: fuel
            <<: *master
#--------------------------------
# NONE-CI POD's
#--------------------------------
#        colorado
#--------------------------------
        - arm-pod2:
            slave-label: arm-pod2
            installer: fuel
            <<: *colorado
        - arm-pod3:
            slave-label: arm-pod3
            installer: fuel
            <<: *colorado
#--------------------------------
#        master
#--------------------------------
        - arm-pod2:
            slave-label: arm-pod2
            installer: fuel
            <<: *master
        - arm-pod3:
            slave-label: arm-pod3
            installer: fuel
            <<: *master
#--------------------------------
#       scenarios
#--------------------------------
    scenario:
        # HA scenarios
        - 'os-nosdn-nofeature-ha':
            auto-trigger-name: '{installer}-{scenario}-{pod}-{stream}-trigger'
        - 'os-odl_l2-nofeature-ha':
            auto-trigger-name: '{installer}-{scenario}-{pod}-{stream}-trigger'
        - 'os-odl_l3-nofeature-ha':
            auto-trigger-name: '{installer}-{scenario}-{pod}-{stream}-trigger'
        - 'os-odl_l2-bgpvpn-ha':
            auto-trigger-name: '{installer}-{scenario}-{pod}-{stream}-trigger'
        - 'os-odl_l2-sfc-ha':
            auto-trigger-name: '{installer}-{scenario}-{pod}-{stream}-trigger'

        # NOHA scenarios
        - 'os-odl_l2-nofeature-noha':
            auto-trigger-name: '{installer}-{scenario}-{pod}-{stream}-trigger'
        - 'os-odl_l2-sfc-noha':
            auto-trigger-name: '{installer}-{scenario}-{pod}-{stream}-trigger'

    jobs:
        - '{installer}-{scenario}-{pod}-daily-{stream}'
        - '{installer}-deploy-{pod}-daily-{stream}'

########################
# job templates
########################
- job-template:
    name: '{installer}-{scenario}-{pod}-daily-{stream}'

    concurrent: false

    properties:
        - throttle:
            enabled: true
            max-total: 4
            max-per-node: 1
            option: 'project'
        - build-blocker:
            use-build-blocker: true
            blocking-jobs:
                - '{installer}-os-.*?-{pod}-daily-.*'
            block-level: 'NODE'

    wrappers:
        - build-name:
            name: '$BUILD_NUMBER - Scenario: $DEPLOY_SCENARIO'

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

    parameters:
        - project-parameter:
            project: '{project}'
        - '{installer}-defaults'
        - '{slave-label}-defaults':
            installer: '{installer}'
        - string:
            name: DEPLOY_SCENARIO
            default: '{scenario}'
        - armband-ci-parameter:
            gs-pathname: '{gs-pathname}'

    builders:
        - trigger-builds:
            - project: '{installer}-deploy-{pod}-daily-{stream}'
              current-parameters: false
              predefined-parameters:
                DEPLOY_SCENARIO={scenario}
              same-node: true
              block: true
        - trigger-builds:
            - project: 'functest-{installer}-{pod}-daily-{stream}'
              current-parameters: false
              predefined-parameters:
                DEPLOY_SCENARIO={scenario}
              block: true
              same-node: true
              block-thresholds:
                build-step-failure-threshold: 'never'
                failure-threshold: 'never'
                unstable-threshold: 'FAILURE'
        - trigger-builds:
            - project: 'yardstick-{installer}-{pod}-daily-{stream}'
              current-parameters: false
              predefined-parameters:
                DEPLOY_SCENARIO={scenario}
              block: true
              same-node: true
              block-thresholds:
                build-step-failure-threshold: 'never'
                failure-threshold: 'never'
                unstable-threshold: 'FAILURE'

- job-template:
    name: '{installer}-deploy-{pod}-daily-{stream}'

    concurrent: true

    properties:
        - throttle:
            enabled: true
            max-total: 4
            max-per-node: 1
            option: 'project'
        - build-blocker:
            use-build-blocker: true
            blocking-jobs:
                - '{installer}-deploy-{pod}-daily-{stream}'
                - '{installer}-deploy-generic-daily-.*'
            block-level: 'NODE'

    parameters:
        - project-parameter:
            project: '{project}'
        - '{installer}-defaults'
        - '{slave-label}-defaults':
            installer: '{installer}'
        - string:
            name: DEPLOY_SCENARIO
            default: 'os-odl_l2-nofeature-ha'
        - armband-ci-parameter:
            gs-pathname: '{gs-pathname}'

    scm:
        - git-scm:
            credentials-id: '{ssh-credentials}'
            refspec: ''
            branch: '{branch}'

    wrappers:
        - build-name:
            name: '$BUILD_NUMBER - Scenario: $DEPLOY_SCENARIO'

    builders:
        - shell:
            !include-raw-escape: ./armband-download-artifact.sh
        - shell:
            !include-raw-escape: ./armband-deploy.sh

    publishers:
        - email:
            recipients: armband@enea.com

########################
# parameter macros
########################
- parameter:
    name: armband-ci-parameter
    parameters:
        - string:
            name: BUILD_DIRECTORY
            default: $WORKSPACE/build_output
            description: "Directory where the build artifact will be located upon the completion of the build."
        - string:
            name: CACHE_DIRECTORY
            default: $HOME/opnfv/cache/$INSTALLER_TYPE
            description: "Directory where the cache to be used during the build is located."
        - string:
            name: GS_URL
            default: artifacts.opnfv.org/$PROJECT{gs-pathname}
            description: "URL to Google Storage."

########################
# trigger macros
########################
# CI PODs
#-----------------------------------------------------------------
# Enea Armband CI Baremetal Triggers running against master branch
#-----------------------------------------------------------------
- trigger:
    name: 'fuel-os-odl_l2-nofeature-ha-armband-baremetal-master-trigger'
    triggers:
        - timed: '0 0 * * 1'
- trigger:
    name: 'fuel-os-nosdn-nofeature-ha-armband-baremetal-master-trigger'
    triggers:
        - timed: '0 0 * * 2'
- trigger:
    name: 'fuel-os-odl_l3-nofeature-ha-armband-baremetal-master-trigger'
    triggers:
        - timed: '0 0 * * 3'
- trigger:
    name: 'fuel-os-odl_l2-bgpvpn-ha-armband-baremetal-master-trigger'
    triggers:
        - timed: '0 0 * * 4'
- trigger:
    name: 'fuel-os-odl_l2-nofeature-noha-armband-baremetal-master-trigger'
    triggers:
        - timed: '0 0 * * 5'
- trigger:
    name: 'fuel-os-odl_l2-sfc-ha-armband-baremetal-master-trigger'
    triggers:
        - timed: '0 0 * * 6'
- trigger:
    name: 'fuel-os-odl_l2-sfc-noha-armband-baremetal-master-trigger'
    triggers:
        - timed: '0 0 * * 7'

#----------------------------------------------------------------------
# Enea Armband CI Baremetal Triggers running against colorado branch
#----------------------------------------------------------------------
- trigger:
    name: 'fuel-os-odl_l2-nofeature-ha-armband-baremetal-colorado-trigger'
    triggers:
        - timed: '0 8 * * 1,3,5,7'
- trigger:
    name: 'fuel-os-nosdn-nofeature-ha-armband-baremetal-colorado-trigger'
    triggers:
        - timed: '0 16 * * 2,7'
- trigger:
    name: 'fuel-os-odl_l2-bgpvpn-ha-armband-baremetal-colorado-trigger'
    triggers:
        - timed: '0 8 * * 2,4,6'
- trigger:
    name: 'fuel-os-odl_l3-nofeature-ha-armband-baremetal-colorado-trigger'
    triggers:
        - timed: '0 16 * * 1,4,6'
- trigger:
    name: 'fuel-os-odl_l2-nofeature-noha-armband-baremetal-colorado-trigger'
    triggers:
        - timed: '0 16 * * 3,5'
- trigger:
    name: 'fuel-os-odl_l2-sfc-ha-armband-baremetal-colorado-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-odl_l2-sfc-noha-armband-baremetal-colorado-trigger'
    triggers:
        - timed: ''
#---------------------------------------------------------------
# Enea Armband CI Virtual Triggers running against master branch
#---------------------------------------------------------------
- trigger:
    name: 'fuel-os-odl_l2-nofeature-ha-armband-virtual-master-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-nosdn-nofeature-ha-armband-virtual-master-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-odl_l3-nofeature-ha-armband-virtual-master-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-odl_l2-bgpvpn-ha-armband-virtual-master-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-odl_l2-nofeature-noha-armband-virtual-master-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-odl_l2-sfc-ha-armband-virtual-master-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-odl_l2-sfc-noha-armband-virtual-master-trigger'
    triggers:
        - timed: ''
#--------------------------------------------------------------------
# Enea Armband CI Virtual Triggers running against colorado branch
#--------------------------------------------------------------------
- trigger:
    name: 'fuel-os-odl_l2-nofeature-ha-armband-virtual-colorado-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-nosdn-nofeature-ha-armband-virtual-colorado-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-odl_l3-nofeature-ha-armband-virtual-colorado-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-odl_l2-bgpvpn-ha-armband-virtual-colorado-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-odl_l2-nofeature-noha-armband-virtual-colorado-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-odl_l2-sfc-ha-armband-virtual-colorado-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-odl_l2-sfc-noha-armband-virtual-colorado-trigger'
    triggers:
        - timed: ''
#----------------------------------------------------------
# Enea Armband POD 2 Triggers running against master branch
#----------------------------------------------------------
- trigger:
    name: 'fuel-os-odl_l2-nofeature-ha-arm-pod2-master-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-nosdn-nofeature-ha-arm-pod2-master-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-odl_l3-nofeature-ha-arm-pod2-master-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-odl_l2-bgpvpn-ha-arm-pod2-master-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-odl_l2-nofeature-noha-arm-pod2-master-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-odl_l2-sfc-ha-arm-pod2-master-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-odl_l2-sfc-noha-arm-pod2-master-trigger'
    triggers:
        - timed: ''
#---------------------------------------------------------------
# Enea Armband POD 2 Triggers running against colorado branch
#---------------------------------------------------------------
- trigger:
    name: 'fuel-os-odl_l2-nofeature-ha-arm-pod2-colorado-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-nosdn-nofeature-ha-arm-pod2-colorado-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-odl_l3-nofeature-ha-arm-pod2-colorado-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-odl_l2-bgpvpn-ha-arm-pod2-colorado-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-odl_l2-nofeature-noha-arm-pod2-colorado-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-odl_l2-sfc-ha-arm-pod2-colorado-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-odl_l2-sfc-noha-arm-pod2-colorado-trigger'
    triggers:
        - timed: ''
#----------------------------------------------------------
# Enea Armband POD 3 Triggers running against master branch
#----------------------------------------------------------
- trigger:
    name: 'fuel-os-odl_l2-nofeature-ha-arm-pod3-master-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-nosdn-nofeature-ha-arm-pod3-master-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-odl_l3-nofeature-ha-arm-pod3-master-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-odl_l2-bgpvpn-ha-arm-pod3-master-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-odl_l2-nofeature-noha-arm-pod3-master-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-odl_l2-sfc-ha-arm-pod3-master-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-odl_l2-sfc-noha-arm-pod3-master-trigger'
    triggers:
        - timed: ''
#---------------------------------------------------------------
# Enea Armband POD 3 Triggers running against colorado branch
#---------------------------------------------------------------
- trigger:
    name: 'fuel-os-odl_l2-nofeature-ha-arm-pod3-colorado-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-nosdn-nofeature-ha-arm-pod3-colorado-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-odl_l3-nofeature-ha-arm-pod3-colorado-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-odl_l2-bgpvpn-ha-arm-pod3-colorado-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-odl_l2-nofeature-noha-arm-pod3-colorado-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-odl_l2-sfc-ha-arm-pod3-colorado-trigger'
    triggers:
        - timed: ''
- trigger:
    name: 'fuel-os-odl_l2-sfc-noha-arm-pod3-colorado-trigger'
    triggers:
        - timed: ''