- project:
    name: 'opera-daily-jobs'

    project: 'opera'

#####################################
# branch definitions
#####################################
    stream:
        - master:
            branch: '{stream}'
            gs-pathname: ''
            disabled: false

#####################################
# patch verification phases
#####################################
    phase:
        - 'basic'
        - 'deploy'

#####################################
# jobs
#####################################
    jobs:
        - 'opera-daily-{stream}'
        - 'opera-daily-{phase}-{stream}'
#####################################
# job templates
#####################################
- job-template:
    name: 'opera-daily-{stream}'

    project-type: multijob

    disabled: '{obj:disabled}'

    concurrent: false

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

    scm:
        - git-scm

    wrappers:
        - ssh-agent-wrapper

        - timeout:
            timeout: 240
            fail: true

    triggers:
         - timed: '@midnight'

    parameters:
        - project-parameter:
            project: '{project}'
            branch: '{branch}'
        - 'huawei-virtual7-defaults'

    builders:
        - description-setter:
            description: "Built on $NODE_NAME"
        - multijob:
            name: basic
            condition: SUCCESSFUL
            projects:
                - name: 'opera-daily-basic-{stream}'
                  current-parameters: true
                  node-parameters: true
                  kill-phase-on: FAILURE
                  abort-all-job: true
        - multijob:
            name: deploy
            condition: SUCCESSFUL
            projects:
                - name: 'compass-deploy-virtual-daily-{stream}'
                  current-parameters: false
                  predefined-parameters: |
                    DEPLOY_SCENARIO=os-nosdn-openo-ha
                    COMPASS_OS_VERSION=xenial
                  node-parameters: true
                  kill-phase-on: FAILURE
                  abort-all-job: true
#        - multijob:
#            name: functest
#            condition: SUCCESSFUL
#            projects:
#                - name: 'functest-compass-baremetal-suite-{stream}'
#                  current-parameters: false
#                  predefined-parameters:
#                    FUNCTEST_SUITE_NAME=opera
#                  node-parameters: true
#                  kill-phase-on: NEVER
#                  abort-all-job: true

- job-template:
    name: 'opera-daily-{phase}-{stream}'

    disabled: '{obj:disabled}'

    concurrent: true

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

    scm:
        - git-scm

    wrappers:
        - ssh-agent-wrapper
        - timeout:
            timeout: 120
            fail: true

    builders:
        - description-setter:
            description: "Built on $NODE_NAME"
        - '{project}-daily-{phase}-macro'

#####################################
# builder macros
#####################################
- builder:
    name: 'opera-daily-basic-macro'
    builders:
        - shell: |
            #!/bin/bash
            echo "Hello world!"

- builder:
    name: 'opera-daily-deploy-macro'
    builders:
        - shell: |
            #!/bin/bash
            echo "Hello world!"