- project:
    name: apex
    jobs:
        - 'apex-verify-{stream}'
        - 'apex-verify-unit-tests-{stream}'
        - 'apex-runner-{platform}-{scenario}-{stream}'
        - 'apex-runner-cperf-{stream}'
        - 'apex-build-{stream}'
        - 'apex-deploy-virtual-{scenario}-{stream}'
        - 'apex-deploy-baremetal-{scenario}-{stream}'
        - 'apex-daily-{stream}'

    # stream:    branch with - in place of / (eg. stable-arno)
    # branch:    branch (eg. stable/arno)
    stream:
        - master:
            branch: 'master'
            gs-pathname: ''
            block-stream: 'colorado'
            slave: 'lf-pod1'
            verify-slave: 'apex-verify-master'
            daily-slave: 'apex-daily-master'
        - colorado:
            branch: 'stable/colorado'
            gs-pathname: '/colorado'
            block-stream: 'master'
            slave: 'lf-pod1'
            verify-slave: 'apex-verify-colorado'
            daily-slave: 'apex-daily-colorado'
            disabled: false

    stream1:
        - master:
            branch: 'master'
            gs-pathname: ''
            block-stream: 'colorado'
            slave: 'lf-pod1'
            verify-slave: 'apex-verify-master'
            daily-slave: 'apex-daily-master'

    stream2:
        - colorado:
            branch: 'stable/colorado'
            gs-pathname: '/colorado'
            block-stream: 'master'
            slave: 'lf-pod1'
            verify-slave: 'apex-verify-colorado'
            daily-slave: 'apex-daily-colorado'
            disabled: false

    project: 'apex'

    scenario:
         - 'os-nosdn-nofeature-noha'
         - 'os-nosdn-nofeature-ha'
         - 'os-nosdn-nofeature-ha-ipv6'
         - 'os-nosdn-ovs-noha'
         - 'os-nosdn-fdio-noha'
         - 'os-odl_l2-nofeature-ha'
         - 'os-odl_l2-bgpvpn-ha'
         - 'os-odl_l2-fdio-noha'
         - 'os-odl_l2-sfc-noha'
         - 'os-odl_l3-nofeature-ha'
         - 'os-onos-nofeature-ha'
         - 'os-onos-sfc-ha'
         - 'os-ocl-nofeature-ha'

    platform:
         - 'baremetal'
         - 'virtual'

# Unit Test
- job-template:
    name: 'apex-verify-unit-tests-{stream}'

    node: '{verify-slave}'

    concurrent: true

    parameters:
        - apex-parameter:
            gs-pathname: '{gs-pathname}'
        - project-parameter:
            project: '{project}'
        - gerrit-parameter:
            branch: '{branch}'
        - string:
            name: GIT_BASE
            default: https://gerrit.opnfv.org/gerrit/$PROJECT
            description: "Used for overriding the GIT URL coming from parameters macro."

    scm:
        - gerrit-trigger-scm:
            credentials-id: '{ssh-credentials}'
            refspec: '$GERRIT_REFSPEC'
            choosing-strategy: 'gerrit'

    triggers:
        - gerrit:
            trigger-on:
                - patchset-created-event:
                    exclude-drafts: 'false'
                    exclude-trivial-rebase: 'false'
                    exclude-no-code-change: 'true'
                - draft-published-event
                - comment-added-contains-event:
                    comment-contains-value: 'recheck'
                - comment-added-contains-event:
                    comment-contains-value: 'reverify'
            projects:
              - project-compare-type: 'ANT'
                project-pattern: 'apex'
                branches:
                  - branch-compare-type: 'ANT'
                    branch-pattern: '**/{branch}'
                file-paths:
                  - compare-type: ANT
                    pattern: 'tests/**'
    properties:
        - throttle:
            max-per-node: 1
            max-total: 10
            option: 'project'

    builders:
        - 'apex-unit-test'

# Verify
- job-template:
    name: 'apex-verify-{stream}'

    node: '{verify-slave}'

    concurrent: true

    parameters:
        - apex-parameter:
            gs-pathname: '{gs-pathname}'
        - project-parameter:
            project: '{project}'
        - gerrit-parameter:
            branch: '{branch}'
        - string:
            name: GIT_BASE
            default: https://gerrit.opnfv.org/gerrit/$PROJECT
            description: "Used for overriding the GIT URL coming from parameters macro."

    scm:
        - gerrit-trigger-scm:
            credentials-id: '{ssh-credentials}'
            refspec: '$GERRIT_REFSPEC'
            choosing-strategy: 'gerrit'

    triggers:
        - gerrit:
            trigger-on:
                - patchset-created-event:
                    exclude-drafts: 'false'
                    exclude-trivial-rebase: 'false'
                    exclude-no-code-change: 'true'
                - draft-published-event
                - comment-added-contains-event:
                    comment-contains-value: 'recheck'
                - comment-added-contains-event:
                    comment-contains-value: 'reverify'
            projects:
              - project-compare-type: 'ANT'
                project-pattern: 'apex'
                branches:
                  - branch-compare-type: 'ANT'
                    branch-pattern: '**/{branch}'
                file-paths:
                  - compare-type: ANT
                    pattern: 'ci/**'
                  - compare-type: ANT
                    pattern: 'build/**'
                  - compare-type: ANT
                    pattern: 'lib/**'
                  - compare-type: ANT
                    pattern: 'config/**'

    properties:
        - build-blocker:
            use-build-blocker: true
            block-level: 'NODE'
            blocking-jobs:
                - 'apex-daily.*'
                - 'apex-deploy.*'
                - 'apex-build.*'
                - 'apex-runner.*'
                - 'apex-verify.*'
        - throttle:
            max-per-node: 1
            max-total: 10
            option: 'project'

    builders:
        - 'apex-unit-test'
        - 'apex-build'
        - trigger-builds:
          - project: 'apex-deploy-virtual-os-nosdn-nofeature-ha-{stream}'
            predefined-parameters: |
              BUILD_DIRECTORY=apex-verify-{stream}
              OPNFV_CLEAN=yes
            git-revision: false
            block: true
            same-node: true
        - trigger-builds:
          - project: 'functest-apex-{verify-slave}-suite-{stream}'
            predefined-parameters: |
              DEPLOY_SCENARIO=os-nosdn-nofeature-ha
              FUNCTEST_SUITE_NAME=healthcheck
            block: true
            same-node: true
        - trigger-builds:
          - project: 'apex-deploy-virtual-os-odl_l2-nofeature-ha-{stream}'
            predefined-parameters: |
              BUILD_DIRECTORY=apex-verify-{stream}
              OPNFV_CLEAN=yes
            git-revision: false
            block: true
            same-node: true
        - trigger-builds:
          - project: 'functest-apex-{verify-slave}-suite-{stream}'
            predefined-parameters: |
              DEPLOY_SCENARIO=os-odl_l2-nofeature-ha
              FUNCTEST_SUITE_NAME=healthcheck
            block: true
            same-node: true
        - 'apex-workspace-cleanup'

- job-template:
    name: 'apex-runner-{platform}-{scenario}-{stream}'

    # runner jobs for deploying manually

    node: '{slave}'

    disabled: false

    parameters:
        - apex-parameter:
            gs-pathname: '{gs-pathname}'
        - project-parameter:
            project: '{project}'
        - gerrit-parameter:
            branch: '{branch}'
        - string:
            name: GIT_BASE
            default: https://gerrit.opnfv.org/gerrit/$PROJECT
            description: "Used for overriding the GIT URL coming from parameters macro."

    scm:
        - gerrit-trigger-scm:
            credentials-id: '{ssh-credentials}'
            refspec: ''
            choosing-strategy: 'default'

    properties:
        - build-blocker:
            use-build-blocker: true
            blocking-jobs:
                - 'apex-daily.*'
                - 'apex-verify.*'

    builders:
        - trigger-builds:
          - project: 'apex-deploy-{platform}-{scenario}-{stream}'
            predefined-parameters:
              OPNFV_CLEAN=yes
            git-revision: false
            block: true
        - trigger-builds:
          - project: 'yardstick-apex-{slave}-daily-{stream}'
            predefined-parameters:
              DEPLOY_SCENARIO={scenario}
            block: true
            block-thresholds:
                build-step-failure-threshold: 'never'
                failure-threshold: 'never'
                unstable-threshold: 'FAILURE'
        - trigger-builds:
          - project: 'functest-apex-{slave}-daily-{stream}'
            predefined-parameters:
              DEPLOY_SCENARIO={scenario}
            block: true
            block-thresholds:
                build-step-failure-threshold: 'never'
                failure-threshold: 'never'
                unstable-threshold: 'FAILURE'

- job-template:
    name: 'apex-runner-cperf-{stream}'

    # runner cperf job

    node: 'intel-pod2'

    disabled: false

    parameters:
        - apex-parameter:
            gs-pathname: '{gs-pathname}'
        - project-parameter:
            project: '{project}'
        - gerrit-parameter:
            branch: '{branch}'
        - string:
            name: GIT_BASE
            default: https://gerrit.opnfv.org/gerrit/$PROJECT
            description: "Used for overriding the GIT URL coming from parameters macro."

    scm:
        - gerrit-trigger-scm:
            credentials-id: '{ssh-credentials}'
            refspec: ''
            choosing-strategy: 'default'

    properties:
        - build-blocker:
            use-build-blocker: false
            block-level: 'NODE'
            blocking-jobs:
                - 'apex-deploy.*'
        - throttle:
            max-per-node: 1
            max-total: 10
            option: 'project'

    builders:
        - trigger-builds:
          - project: 'apex-deploy-baremetal-os-odl_l2-nofeature-ha-{stream}'
            predefined-parameters:
              OPNFV_CLEAN=yes
            git-revision: false
            block: true
            same-node: true
        - trigger-builds:
          - project: 'cperf-apex-intel-pod2-daily-{stream}'
            predefined-parameters:
              DEPLOY_SCENARIO=os-odl_l2-nofeature-ha
            block: true
            same-node: true

- job-template:
    name: 'apex-build-{stream}'

    # Job template for builds
    #
    # Required Variables:
    #     stream:    branch with - in place of / (eg. stable)
    #     branch:    branch (eg. stable)
    node: '{daily-slave}'

    disabled: false

    concurrent: true

    parameters:
        - project-parameter:
            project: '{project}'
        - apex-parameter:
            gs-pathname: '{gs-pathname}'
        - gerrit-parameter:
            branch: '{branch}'
        - string:
            name: GIT_BASE
            default: https://gerrit.opnfv.org/gerrit/$PROJECT
            description: "Used for overriding the GIT URL coming from parameters macro."

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

    properties:
        - build-blocker:
            use-build-blocker: true
            block-level: 'NODE'
            blocking-jobs:
                - 'apex-deploy.*'
        - throttle:
            max-per-node: 1
            max-total: 10
            option: 'project'

    builders:
        - 'apex-build'
        - trigger-builds:
          - project: 'apex-deploy-virtual-os-nosdn-nofeature-noha-{stream}'
            predefined-parameters: |
              BUILD_DIRECTORY=apex-build-{stream}/build
              OPNFV_CLEAN=yes
            git-revision: false
            same-node: true
            block: true
        - 'apex-upload-artifact'

- job-template:
    name: 'apex-deploy-virtual-{scenario}-{stream}'

    # Job template for virtual deployment
    #
    # Required Variables:
    #     stream:    branch with - in place of / (eg. stable)
    #     branch:    branch (eg. stable)
    node: '{slave}'

    concurrent: true

    disabled: false

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

    parameters:
        - project-parameter:
            project: '{project}'
        - apex-parameter:
            gs-pathname: '{gs-pathname}'
        - string:
            name: DEPLOY_SCENARIO
            default: '{scenario}'
            description: "Scenario to deploy with."
        - string:
            name: OPNFV_CLEAN
            default: 'no'
            description: "Use yes in lower case to invoke clean. Indicates if the deploy environment should be cleaned before deployment"

    properties:
        - build-blocker:
            use-build-blocker: true
            block-level: 'NODE'
            blocking-jobs:
                - 'apex-deploy.*'
        - throttle:
            max-per-node: 1
            max-total: 10
            option: 'project'

    builders:
        - 'apex-deploy'
        - 'apex-workspace-cleanup'

- job-template:
    name: 'apex-deploy-baremetal-{scenario}-{stream}'

    # Job template for baremetal deployment
    #
    # Required Variables:
    #     stream:    branch with - in place of / (eg. stable)
    #     branch:    branch (eg. stable)
    node: '{slave}'

    disabled: false

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

    parameters:
        - project-parameter:
            project: '{project}'
        - apex-parameter:
            gs-pathname: '{gs-pathname}'
        - string:
            name: DEPLOY_SCENARIO
            default: '{scenario}'
            description: "Scenario to deploy with."

    properties:
        - build-blocker:
            use-build-blocker: true
            block-level: 'NODE'
            blocking-jobs:
                - 'apex-verify.*'
                - 'apex-deploy.*'
                - 'apex-build.*'


    builders:
        - 'apex-deploy'
        - 'apex-workspace-cleanup'

# Daily
- job-template:
    name: 'apex-daily-{stream}'

    # Job template for daily build
    #
    # Required Variables:
    #     stream:    branch with - in place of / (eg. stable)
    #     branch:    branch (eg. stable)
    node: '{daily-slave}'

    disabled: false

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

    parameters:
        - project-parameter:
            project: '{project}'
        - apex-parameter:
            gs-pathname: '{gs-pathname}'

    properties:
        - build-blocker:
            use-build-blocker: true
            block-level: 'NODE'
            blocking-jobs:
                - 'apex-verify.*'
                - 'apex-deploy.*'
                - 'apex-build.*'
                - 'apex-runner.*'

    triggers:
        - 'apex-{stream}'

    builders:
        - trigger-builds:
          - project: 'apex-build-{stream}'
            git-revision: true
            current-parameters: true
            same-node: true
            block: true
        - trigger-builds:
          - project: 'apex-deploy-baremetal-os-nosdn-nofeature-ha-{stream}'
            predefined-parameters: |
              BUILD_DIRECTORY=apex-build-{stream}/build
              OPNFV_CLEAN=yes
            git-revision: true
            same-node: true
            block-thresholds:
                build-step-failure-threshold: 'never'
            block: true
        - trigger-builds:
          - project: 'functest-apex-{daily-slave}-daily-{stream}'
            predefined-parameters:
              DEPLOY_SCENARIO=os-nosdn-nofeature-ha
            block: true
            same-node: true
            block-thresholds:
                build-step-failure-threshold: 'never'
                failure-threshold: 'never'
                unstable-threshold: 'FAILURE'
        - trigger-builds:
          - project: 'yardstick-apex-{slave}-daily-{stream}'
            predefined-parameters:
              DEPLOY_SCENARIO=os-nosdn-nofeature-ha
            block: true
            same-node: true
            block-thresholds:
                build-step-failure-threshold: 'never'
                failure-threshold: 'never'
                unstable-threshold: 'FAILURE'
        - trigger-builds:
          - project: 'apex-deploy-baremetal-os-odl_l2-nofeature-ha-{stream}'
            predefined-parameters: |
              BUILD_DIRECTORY=apex-build-{stream}/build
              OPNFV_CLEAN=yes
            git-revision: true
            same-node: true
            block-thresholds:
                build-step-failure-threshold: 'never'
            block: true
        - trigger-builds:
          - project: 'functest-apex-{daily-slave}-daily-{stream}'
            predefined-parameters:
              DEPLOY_SCENARIO=os-odl_l2-nofeature-ha
            block: true
            same-node: true
            block-thresholds:
                build-step-failure-threshold: 'never'
                failure-threshold: 'never'
                unstable-threshold: 'FAILURE'
        - trigger-builds:
          - project: 'yardstick-apex-{slave}-daily-{stream}'
            predefined-parameters:
              DEPLOY_SCENARIO=os-odl_l2-nofeature-ha
            block: true
            same-node: true
            block-thresholds:
                build-step-failure-threshold: 'never'
                failure-threshold: 'never'
                unstable-threshold: 'FAILURE'
        - trigger-builds:
          - project: 'apex-deploy-baremetal-os-odl_l3-nofeature-ha-{stream}'
            predefined-parameters: |
              BUILD_DIRECTORY=apex-build-{stream}/build
              OPNFV_CLEAN=yes
            git-revision: true
            same-node: true
            block-thresholds:
                build-step-failure-threshold: 'never'
            block: true
        - trigger-builds:
          - project: 'functest-apex-{daily-slave}-daily-{stream}'
            predefined-parameters:
              DEPLOY_SCENARIO=os-odl_l3-nofeature-ha
            block: true
            same-node: true
            block-thresholds:
                build-step-failure-threshold: 'never'
                failure-threshold: 'never'
                unstable-threshold: 'FAILURE'
        - trigger-builds:
          - project: 'yardstick-apex-{slave}-daily-{stream}'
            predefined-parameters:
              DEPLOY_SCENARIO=os-odl_l3-nofeature-ha
            block: true
            same-node: true
            block-thresholds:
                build-step-failure-threshold: 'never'
                failure-threshold: 'never'
                unstable-threshold: 'FAILURE'
        - trigger-builds:
          - project: 'apex-deploy-baremetal-os-onos-nofeature-ha-{stream}'
            predefined-parameters: |
              BUILD_DIRECTORY=apex-build-{stream}/build
              OPNFV_CLEAN=yes
            git-revision: true
            same-node: true
            block-thresholds:
                build-step-failure-threshold: 'never'
            block: true
        - trigger-builds:
          - project: 'functest-apex-{daily-slave}-daily-{stream}'
            predefined-parameters:
              DEPLOY_SCENARIO=os-onos-nofeature-ha
            block: true
            same-node: true
            block-thresholds:
                build-step-failure-threshold: 'never'
                failure-threshold: 'never'
                unstable-threshold: 'FAILURE'
        - trigger-builds:
          - project: 'yardstick-apex-{slave}-daily-{stream}'
            predefined-parameters:
              DEPLOY_SCENARIO=os-onos-nofeature-ha
            block: true
            same-node: true
            block-thresholds:
                build-step-failure-threshold: 'never'
                failure-threshold: 'never'
                unstable-threshold: 'FAILURE'
        - trigger-builds:
          - project: 'apex-deploy-baremetal-os-odl_l2-bgpvpn-ha-{stream}'
            predefined-parameters: |
              BUILD_DIRECTORY=apex-build-{stream}/build
              OPNFV_CLEAN=yes
            git-revision: true
            same-node: true
            block-thresholds:
                build-step-failure-threshold: 'never'
            block: true
        - trigger-builds:
          - project: 'functest-apex-{daily-slave}-daily-{stream}'
            predefined-parameters:
              DEPLOY_SCENARIO=os-odl_l2-bgpvpn-ha
            block: true
            same-node: true
            block-thresholds:
                build-step-failure-threshold: 'never'
                failure-threshold: 'never'
                unstable-threshold: 'FAILURE'
        - trigger-builds:
          - project: 'yardstick-apex-{slave}-daily-{stream}'
            predefined-parameters:
              DEPLOY_SCENARIO=os-odl_l2-bgpvpn-ha
            block: true
            same-node: true
            block-thresholds:
                build-step-failure-threshold: 'never'
                failure-threshold: 'never'
                unstable-threshold: 'FAILURE'
        - trigger-builds:
          - project: 'apex-deploy-baremetal-os-onos-sfc-ha-{stream}'
            predefined-parameters: |
              BUILD_DIRECTORY=apex-build-{stream}/build
              OPNFV_CLEAN=yes
            git-revision: true
            same-node: true
            block-thresholds:
                build-step-failure-threshold: 'never'
            block: true
        - trigger-builds:
          - project: 'functest-apex-{daily-slave}-daily-{stream}'
            predefined-parameters:
              DEPLOY_SCENARIO=os-onos-sfc-ha
            block: true
            same-node: true
            block-thresholds:
                build-step-failure-threshold: 'never'
                failure-threshold: 'never'
                unstable-threshold: 'FAILURE'
        - trigger-builds:
          - project: 'yardstick-apex-{slave}-daily-{stream}'
            predefined-parameters:
              DEPLOY_SCENARIO=os-onos-sfc-ha
            block: true
            same-node: true
            block-thresholds:
                build-step-failure-threshold: 'never'
                failure-threshold: 'never'
                unstable-threshold: 'FAILURE'
        - trigger-builds:
          - project: 'apex-deploy-baremetal-os-odl_l2-sfc-noha-{stream}'
            predefined-parameters: |
              BUILD_DIRECTORY=apex-build-{stream}/build
              OPNFV_CLEAN=yes
            git-revision: true
            same-node: true
            block-thresholds:
                build-step-failure-threshold: 'never'
            block: true
        - trigger-builds:
          - project: 'functest-apex-{daily-slave}-daily-{stream}'
            predefined-parameters:
              DEPLOY_SCENARIO=os-odl_l2-sfc-noha
            block: true
            same-node: true
            block-thresholds:
                build-step-failure-threshold: 'never'
                failure-threshold: 'never'
                unstable-threshold: 'FAILURE'
        - trigger-builds:
          - project: 'yardstick-apex-{slave}-daily-{stream}'
            predefined-parameters:
              DEPLOY_SCENARIO=os-odl_l2-sfc-noha
            block: true
            same-node: true
            block-thresholds:
                build-step-failure-threshold: 'never'
                failure-threshold: 'never'
                unstable-threshold: 'FAILURE'
        - trigger-builds:
          - project: 'apex-deploy-baremetal-os-odl_l2-fdio-noha-{stream}'
            predefined-parameters: |
              BUILD_DIRECTORY=apex-build-{stream}/build
              OPNFV_CLEAN=yes
            git-revision: true
            same-node: true
            block-thresholds:
                build-step-failure-threshold: 'never'
            block: true
        - trigger-builds:
          - project: 'functest-apex-{daily-slave}-daily-{stream}'
            predefined-parameters:
              DEPLOY_SCENARIO=os-odl_l2-fdio-noha
            block: true
            same-node: true
            block-thresholds:
                build-step-failure-threshold: 'never'
                failure-threshold: 'never'
                unstable-threshold: 'FAILURE'
        - trigger-builds:
          - project: 'yardstick-apex-{slave}-daily-{stream}'
            predefined-parameters:
              DEPLOY_SCENARIO=os-odl_l2-fdio-noha
            block: true
            same-node: true
            block-thresholds:
                build-step-failure-threshold: 'never'
                failure-threshold: 'never'
                unstable-threshold: 'FAILURE'
        - trigger-builds:
          - project: 'apex-deploy-baremetal-os-nosdn-fdio-noha-{stream}'
            predefined-parameters: |
              BUILD_DIRECTORY=apex-build-{stream}/build
              OPNFV_CLEAN=yes
            git-revision: true
            same-node: true
            block-thresholds:
                build-step-failure-threshold: 'never'
            block: true
        - trigger-builds:
          - project: 'functest-apex-{daily-slave}-daily-{stream}'
            predefined-parameters:
              DEPLOY_SCENARIO=os-nosdn-fdio-noha
            block: true
            same-node: true
            block-thresholds:
                build-step-failure-threshold: 'never'
                failure-threshold: 'never'
                unstable-threshold: 'FAILURE'
        - trigger-builds:
          - project: 'yardstick-apex-{slave}-daily-{stream}'
            predefined-parameters:
              DEPLOY_SCENARIO=os-nosdn-fdio-noha
            block: true
            same-node: true
            block-thresholds:
                build-step-failure-threshold: 'never'
                failure-threshold: 'never'
                unstable-threshold: 'FAILURE'
        - trigger-builds:
          - project: 'apex-deploy-virtual-os-nosdn-nofeature-ha-ipv6-{stream}'
            predefined-parameters: |
              BUILD_DIRECTORY=apex-build-{stream}/build
              OPNFV_CLEAN=yes
            git-revision: true
            same-node: true
            block-thresholds:
                build-step-failure-threshold: 'never'
            block: true
        - trigger-builds:
          - project: 'apex-deploy-baremetal-os-nosdn-ovs-noha-{stream}'
            predefined-parameters: |
              BUILD_DIRECTORY=apex-build-{stream}/build
              OPNFV_CLEAN=yes
            git-revision: true
            same-node: true
            block-thresholds:
                build-step-failure-threshold: 'never'
            block: true
        - trigger-builds:
          - project: 'functest-apex-{daily-slave}-daily-{stream}'
            predefined-parameters:
              DEPLOY_SCENARIO=os-nosdn-ovs-noha
            block: true
            same-node: true
            block-thresholds:
                build-step-failure-threshold: 'never'
                failure-threshold: 'never'
                unstable-threshold: 'FAILURE'
        - trigger-builds:
          - project: 'yardstick-apex-{slave}-daily-{stream}'
            predefined-parameters:
              DEPLOY_SCENARIO=os-nosdn-ovs-noha
            block: true
            same-node: true
            block-thresholds:
                build-step-failure-threshold: 'never'
                failure-threshold: 'never'
                unstable-threshold: 'FAILURE'

- job-template:
    name: 'apex-gs-clean-{stream}'

    # Job template for clean
    #
    # Required Variables:
    #     stream:    branch with - in place of / (eg. stable)
    node: '{slave}'

    disabled: false

    parameters:
        - project-parameter:
            project: '{project}'
        - apex-parameter:
            gs-pathname: '{gs-pathname}'

    builders:
        - 'apex-gs-clean'

    triggers:
        - 'apex-gs-clean-{stream}'


########################
# parameter macros
########################
- parameter:
    name: apex-parameter
    parameters:
        - string:
            name: ARTIFACT_NAME
            default: 'latest'
            description: "RPM Artifact name that will be appended to GS_URL to deploy a specific artifact"
        - string:
            name: ARTIFACT_VERSION
            default: 'daily'
            description: "Artifact version type"
        - string:
            name: BUILD_DIRECTORY
            default: $WORKSPACE/build
            description: "Directory where the build artifact will be located upon the completion of the build."
        - string:
            name: CACHE_DIRECTORY
            default: $HOME/opnfv/cache{gs-pathname}
            description: "Directory where the cache to be used during the build is located."
        - string:
            name: GIT_BASE
            default: https://gerrit.opnfv.org/gerrit/$PROJECT
            description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
        - string:
            name: GS_PATHNAME
            default: '{gs-pathname}'
            description: "Version directory where opnfv artifacts are stored in gs repository"
        - string:
            name: GS_URL
            default: artifacts.opnfv.org/$PROJECT{gs-pathname}
            description: "URL to Google Storage."

########################
# builder macros
########################
- builder:
    name: 'apex-unit-test'
    builders:
        - shell:
            !include-raw: ./apex-unit-test.sh

- builder:
    name: 'apex-build'
    builders:
        - shell:
            !include-raw: ./apex-build.sh

- builder:
    name: 'apex-workspace-cleanup'
    builders:
        - shell:
            !include-raw: ./apex-workspace-cleanup.sh

- builder:
    name: 'apex-upload-artifact'
    builders:
        - shell:
            !include-raw: ./apex-upload-artifact.sh

- builder:
    name: 'apex-gs-cleanup'
    builders:
        - shell:
            !include-raw: ./apex-gs-cleanup.sh

- builder:
    name: 'apex-deploy'
    builders:
        - shell:
            !include-raw: ./apex-deploy.sh


#######################
# trigger macros
########################
- trigger:
    name: 'apex-master'
    triggers:
        - timed: '0 3 * * 0'
        - timed: '0 3 * * 4'
- trigger:
    name: 'apex-colorado'
    triggers:
        - timed: '0 3 * * 1'
        - timed: '0 3 * * 2'
        - timed: '0 3 * * 3'
        - timed: '0 3 * * 5'
        - timed: '0 3 * * 6'
- trigger:
    name: 'apex-gs-clean-{stream}'
    triggers:
        - timed: '0 2 * * *'