---
# POD Nightly Build Pipeline Jobs

- test-pipe-job-boiler-plate: &test-pipe-job-boiler-plate
    name: test-pipe-job-boiler-plate

    project-type: pipeline

    sandbox: true

    properties:
      - cord-infra-properties:
          build-days-to-keep: '{build-days-to-keep}'
          artifact-num-to-keep: '{artifact-num-to-keep}'


- job-template:
    name: 'build_{profile}_{config-pod}_{branch}_manual'
    id: build_pod_manual
    description: |
                  <!-- Managed by Jenkins Job Builder -->
                  Manual Build on POD {config-pod} using {Jenkinsfile} <br /><br />
                  Created from job-template {id} from ci-management/jjb/cord-test/cord-test-pipeline.yaml <br />
                  Created by QA (Suchitra Vemuri - suchitra@opennetworking.org ) <br />
                  Copyright (c) 2018 Open Networking Foundation (ONF)

    <<: *test-pipe-job-boiler-plate

    parameters:
      - string:
         name: TestNodeName
         default: '{testvm}'
         description: 'Jenkins node name of TestVM Node'

      - string:
         name: cordRepoUrl
         default: '{gerrit-server-url}'
         description: 'The URL of the CORD Project repository'

      - string:
         name: configBaseDir
         default: 'pod-configs'
         description: 'The directory inside the POD configs repository'

      - string:
         name: configDeploymentDir
         default: 'deployment-configs'
         description: 'The deployment configs folder'

      - string:
         name: configKubernetesDir
         default: 'kubernetes-configs'
         description: 'The kubernetes config folder'

      - string:
         name: configToscaDir
         default: 'tosca-configs'
         description: 'The tosca config folder'

      - string:
         name: configFileName
         default: '{config-pod}'
         description: 'The config file'

      - string:
         name: oltDebVersion
         default: '{oltDebVersion}'
         description: 'OLT Software version to install'

      - string:
         name: branch
         default: '{branch}'

      - string:
         name: profile
         default: '{profile}'
         description: 'Profile in which this job installs'

      - string:
         name: notificationEmail
         default: 'kailash@opennetworking.org, you@opennetworking.org, suchitra@opennetworking.org'
         description: ''

      - bool:
          name: configurePod
          default: true
          description: "Configure POD via TOSCA post build"

      - bool:
            name: reinstallOlt
            default: true
            description: "Re-install olt software bringing up CORD"

      - bool:
          name: installBBSim
          default: false
          description: "Install the BBSim container"

      - string:
          name: onuNumber
          default: '16'
          description: "Onus per PonPort"

    concurrent: true

    pipeline-scm:
      script-path: '{Jenkinsfile}'
      scm:
        - git:
           url: '{gerrit-server-url}/cord-tester'
           branches:
             - '{branch}'

- job-template:
    name: 'build_{profile}_{config-pod}_{branch}'
    id: build_pod_timer
    description: |
                  <!-- Managed by Jenkins Job Builder -->
                  Nightly Kubernetes tests on {config-pod} <br /><br />
                  Created from job-template {id} from ci-management/jjb/cord-test/cord-test-pipeline.yaml <br />
                  Created by Suchitra Vemuri, suchitra@opennetworking.org <br />
                  Copyright (c) 2017 Open Networking Foundation (ONF)

    <<: *test-pipe-job-boiler-plate

    parameters:
      - string:
         name: TestNodeName
         default: '{testvm}'
         description: 'Jenkins node name of TestVM Node'

      - string:
         name: cordRepoUrl
         default: '{gerrit-server-url}'
         description: 'The URL of the CORD Project repository'

      - string:
         name: configBaseDir
         default: 'pod-configs'
         description: 'The directory inside the POD configs repository'

      - string:
         name: configDeploymentDir
         default: 'deployment-configs'
         description: 'The deployment configs folder'

      - string:
         name: configKubernetesDir
         default: 'kubernetes-configs'
         description: 'The kubernetes config folder'

      - string:
         name: configToscaDir
         default: 'tosca-configs'
         description: 'The tosca config folder'

      - string:
         name: configFileName
         default: '{config-pod}'
         description: 'The config file'

      - string:
         name: oltDebVersion
         default: '{oltDebVersion}'
         description: 'OLT Software version to install'

      - string:
         name: branch
         default: '{branch}'

      - string:
         name: profile
         default: '{profile}'
         description: 'Profile in which this job installs'

      - bool:
          name: configurePod
          default: true
          description: "Configure POD via TOSCA post build"

      - bool:
            name: reinstallOlt
            default: true
            description: "Re-install olt software bringing up CORD"

      - bool:
          name: installBBSim
          default: false
          description: "Install the BBSim container"

      - string:
          name: onuNumber
          default: '16'
          description: "Onus per PonPort"

      - string:
         name: notificationEmail
         default: 'kailash@opennetworking.org, you@opennetworking.org, suchitra@opennetworking.org'
         description: ''

    concurrent: true

    pipeline-scm:
      script-path: '{Jenkinsfile}'
      scm:
        - git:
           url: '{gerrit-server-url}/cord-tester'
           branches:
             - '{branch}'

    triggers:
       - timed: |
                 TZ=America/Los_Angeles
                 H {time} * * *

- job-template:
    name: 'build_{profile}_{config-pod}_{branch}_test'
    id: build_pod_test
    description: |
                  <!-- Managed by Jenkins Job Builder -->
                  Post Tests on {config-pod} triggered by build_{config-pod}_{branch} <br /><br />
                  Created from job-template {id} from ci-management/jjb/cord-test/cord-test-pipeline.yaml <br />
                  Created by Kailash Khalasi - kailash@opennetworking.org <br />
                  Copyright (c) 2017 Open Networking Foundation (ONF)

    <<: *test-pipe-job-boiler-plate

    parameters:
      - string:
         name: TestNodeName
         default: '{testvm}'
         description: 'Jenkins node name of TestVM Node'

      - string:
         name: cordRepoUrl
         default: '{gerrit-server-url}'
         description: 'The URL of the CORD Project repository'

      - string:
         name: configBaseDir
         default: 'pod-configs'
         description: 'The directory inside the POD configs repository'

      - string:
         name: configDeploymentDir
         default: 'deployment-configs'
         description: 'The deployment configs folder'

      - string:
         name: configKubernetesDir
         default: 'kubernetes-configs'
         description: 'The kubernetes config folder'

      - string:
         name: configToscaDir
         default: 'tosca-configs'
         description: 'The tosca config folder'

      - string:
         name: configFileName
         default: '{config-pod}'
         description: 'The config file'

      - string:
         name: branch
         default: '{branch}'

      - string:
         name: notificationEmail
         default: 'kailash@opennetworking.org, you@opennetworking.org, suchitra@opennetworking.org'
         description: ''

    concurrent: true

    pipeline-scm:
      script-path: '{Jenkinsfile}'
      scm:
        - git:
           url: '{gerrit-server-url}/cord-tester'
           branches:
             - '{branch}'

    triggers:
      - reverse:
          jobs: 'build_{profile}_{config-pod}_{branch}'
          result: 'success'

- job-template:
    name: 'build_{profile}_{config-pod}_{branch}_post_actions'
    id: post_build_actions
    description: |
                  <!-- Managed by Jenkins Job Builder -->
                  Post Actions on {config-pod} triggered by build_{config-pod}_{branch}. Service ofagent restart required <br /><br />
                  Created from job-template {id} from ci-management/jjb/cord-test/cord-test-pipeline.yaml <br />
                  Created by Kailash Khalasi - kailash@opennetworking.org <br />
                  Copyright (c) 2017 Open Networking Foundation (ONF)

    <<: *test-pipe-job-boiler-plate

    parameters:
      - string:
         name: TestNodeName
         default: '{testvm}'
         description: 'Jenkins node name of TestVM Node'

      - string:
         name: cordRepoUrl
         default: '{gerrit-server-url}'
         description: 'The URL of the CORD Project repository'

      - string:
         name: configBaseDir
         default: 'pod-configs'
         description: 'The directory inside the POD configs repository'

      - string:
         name: configDeploymentDir
         default: 'deployment-configs'
         description: 'The deployment configs folder'

      - string:
         name: configKubernetesDir
         default: 'kubernetes-configs'
         description: 'The kubernetes config folder'

      - string:
         name: configFileName
         default: '{config-pod}'
         description: 'The config file'

      - string:
         name: branch
         default: '{branch}'

      - string:
         name: notificationEmail
         default: 'kailash@opennetworking.org, you@opennetworking.org, suchitra@opennetworking.org'
         description: ''

    concurrent: true

    pipeline-scm:
      script-path: '{Jenkinsfile}'
      scm:
        - git:
           url: '{gerrit-server-url}/cord-tester'
           branches:
             - '{branch}'

    triggers:
      - reverse:
          jobs: 'build_{profile}_{config-pod}_{branch}'
          result: 'failure'

- job-template:
    name: 'build_{config-pod}_seba_release_{release}'
    id: build_pod_manual_release
    description: |
                  <!-- Managed by Jenkins Job Builder -->
                  Manual Build on POD {config-pod} using {Jenkinsfile} <br /><br />
                  Created from job-template {id} from ci-management/jjb/cord-test/cord-test-pipeline.yaml <br />
                  Created by QA (Suchitra Vemuri - suchitra@opennetworking.org ) <br />
                  Copyright (c) 2018 Open Networking Foundation (ONF)

    <<: *test-pipe-job-boiler-plate

    parameters:
      - string:
         name: TestNodeName
         default: '{testvm}'
         description: 'Jenkins node name of TestVM Node'

      - string:
         name: cordRepoUrl
         default: '{gerrit-server-url}'
         description: 'The URL of the CORD Project repository'

      - string:
         name: configBaseDir
         default: 'pod-configs'
         description: 'The directory inside the POD configs repository'

      - string:
         name: configDeploymentDir
         default: 'deployment-configs'
         description: 'The deployment configs folder'

      - string:
         name: configKubernetesDir
         default: 'kubernetes-configs'
         description: 'The kubernetes config folder'

      - string:
         name: configToscaDir
         default: 'tosca-configs'
         description: 'The tosca config folder'

      - string:
         name: configFileName
         default: '{config-pod}'
         description: 'The config file'

      - string:
         name: oltDebVersion
         default: '{oltDebVersion}'
         description: 'OLT Software version to install'

      - string:
         name: branch
         default: '{branch}'

      - string:
         name: notificationEmail
         default: 'kailash@opennetworking.org, you@opennetworking.org, suchitra@opennetworking.org'
         description: ''

      - bool:
          name: configurePod
          default: true
          description: "Configure POD via TOSCA post build"

      - bool:
            name: reinstallOlt
            default: true
            description: "Re-install olt software bringing up CORD"

      - bool:
          name: installBBSim
          default: false
          description: "Install the BBSim container"

      - string:
          name: onuNumber
          default: '16'
          description: "Onus per PonPort"

    concurrent: true

    pipeline-scm:
      script-path: '{Jenkinsfile}'
      scm:
        - git:
           url: '{gerrit-server-url}/cord-tester'
           branches:
             - '{branch}'

- job-template:
    name: 'build_{config-pod}_seba_release_{release}'
    id: build_pod_release
    description: |
                  <!-- Managed by Jenkins Job Builder -->
                  Manual Build on POD {config-pod} using {Jenkinsfile} <br /><br />
                  Created from job-template {id} from ci-management/jjb/cord-test/cord-test-pipeline.yaml <br />
                  Created by QA (Suchitra Vemuri - suchitra@opennetworking.org ) <br />
                  Copyright (c) 2018 Open Networking Foundation (ONF)

    <<: *test-pipe-job-boiler-plate

    parameters:
      - string:
         name: TestNodeName
         default: '{testvm}'
         description: 'Jenkins node name of TestVM Node'

      - string:
         name: cordRepoUrl
         default: '{gerrit-server-url}'
         description: 'The URL of the CORD Project repository'

      - string:
         name: configBaseDir
         default: 'pod-configs'
         description: 'The directory inside the POD configs repository'

      - string:
         name: configDeploymentDir
         default: 'deployment-configs'
         description: 'The deployment configs folder'

      - string:
         name: configKubernetesDir
         default: 'kubernetes-configs'
         description: 'The kubernetes config folder'

      - string:
         name: configToscaDir
         default: 'tosca-configs'
         description: 'The tosca config folder'

      - string:
         name: configFileName
         default: '{config-pod}'
         description: 'The config file'

      - string:
         name: oltDebVersion
         default: '{oltDebVersion}'
         description: 'OLT Software version to install'

      - string:
         name: branch
         default: '{branch}'

      - string:
         name: notificationEmail
         default: 'kailash@opennetworking.org, you@opennetworking.org, suchitra@opennetworking.org'
         description: ''

      - bool:
          name: configurePod
          default: true
          description: "Configure POD via TOSCA post build"

      - bool:
            name: reinstallOlt
            default: true
            description: "Re-install olt software bringing up CORD"

      - bool:
          name: installBBSim
          default: false
          description: "Install the BBSim container"

      - string:
          name: onuNumber
          default: '16'
          description: "Onus per PonPort"

    concurrent: true

    pipeline-scm:
      script-path: '{Jenkinsfile}'
      scm:
        - git:
           url: '{gerrit-server-url}/cord-tester'
           branches:
             - '{branch}'

    triggers:
       - timed: |
                 TZ=America/Los_Angeles
                 H {time} * * *


- job-template:
    name: 'build_{config-pod}_seba_release_{release}_microcharts'
    id: build_pod_manual_release_micro
    description: |
                  <!-- Managed by Jenkins Job Builder -->
                  Manual Build on POD {config-pod} using {Jenkinsfile} <br /><br />
                  Created from job-template {id} from ci-management/jjb/cord-test/cord-test-pipeline.yaml <br />
                  Created by QA (Suchitra Vemuri - suchitra@opennetworking.org ) <br />
                  Copyright (c) 2018 Open Networking Foundation (ONF)

    <<: *test-pipe-job-boiler-plate

    parameters:
      - string:
         name: TestNodeName
         default: '{testvm}'
         description: 'Jenkins node name of TestVM Node'

      - string:
         name: cordRepoUrl
         default: '{gerrit-server-url}'
         description: 'The URL of the CORD Project repository'

      - string:
         name: configBaseDir
         default: 'pod-configs'
         description: 'The directory inside the POD configs repository'

      - string:
         name: configDeploymentDir
         default: 'deployment-configs'
         description: 'The deployment configs folder'

      - string:
         name: configKubernetesDir
         default: 'kubernetes-configs'
         description: 'The kubernetes config folder'

      - string:
         name: configToscaDir
         default: 'tosca-configs'
         description: 'The tosca config folder'

      - string:
         name: configFileName
         default: '{config-pod}'
         description: 'The config file'

      - string:
         name: oltDebVersion
         default: '{oltDebVersion}'
         description: 'OLT Software version to install'

      - string:
         name: branch
         default: '{branch}'

      - string:
         name: notificationEmail
         default: 'kailash@opennetworking.org, you@opennetworking.org, suchitra@opennetworking.org'
         description: ''

      - bool:
          name: configurePod
          default: true
          description: "Configure POD via TOSCA post build"

      - bool:
            name: reinstallOlt
            default: true
            description: "Re-install olt software bringing up CORD"

      - bool:
          name: installBBSim
          default: false
          description: "Install the BBSim container"

      - string:
          name: onuNumber
          default: '16'
          description: "Onus per PonPort"

    concurrent: true

    pipeline-scm:
      script-path: '{Jenkinsfile}'
      scm:
        - git:
           url: '{gerrit-server-url}/cord-tester'
           branches:
             - '{branch}'

- job-template:
    name: 'build_{config-pod}_seba_release_{release}_test'
    id: build_pod_release_test
    description: |
                  <!-- Managed by Jenkins Job Builder -->
                  Post Tests on {config-pod} triggered by build_{config-pod}_{branch} <br /><br />
                  Created from job-template {id} from ci-management/jjb/cord-test/cord-test-pipeline.yaml <br />
                  Created by Kailash Khalasi - kailash@opennetworking.org <br />
                  Copyright (c) 2017 Open Networking Foundation (ONF)

    <<: *test-pipe-job-boiler-plate

    parameters:
      - string:
         name: TestNodeName
         default: '{testvm}'
         description: 'Jenkins node name of TestVM Node'

      - string:
         name: cordRepoUrl
         default: '{gerrit-server-url}'
         description: 'The URL of the CORD Project repository'

      - string:
         name: configBaseDir
         default: 'pod-configs'
         description: 'The directory inside the POD configs repository'

      - string:
         name: configDeploymentDir
         default: 'deployment-configs'
         description: 'The deployment configs folder'

      - string:
         name: configKubernetesDir
         default: 'kubernetes-configs'
         description: 'The kubernetes config folder'

      - string:
         name: configToscaDir
         default: 'tosca-configs'
         description: 'The tosca config folder'

      - string:
         name: configFileName
         default: '{config-pod}'
         description: 'The config file'

      - string:
         name: branch
         default: '{branch}'

      - string:
         name: notificationEmail
         default: 'kailash@opennetworking.org, you@opennetworking.org, suchitra@opennetworking.org'
         description: ''

    concurrent: true

    pipeline-scm:
      script-path: '{Jenkinsfile}'
      scm:
        - git:
           url: '{gerrit-server-url}/cord-tester'
           branches:
             - '{branch}'

    triggers:
      - reverse:
          jobs: 'build_{config-pod}_seba_release_{release}'
          result: 'success'


- job-template:
    name: 'build_{config-pod}_seba_release_{release}_microcharts_test'
    id: build_pod_release_test_microcharts
    description: |
                  <!-- Managed by Jenkins Job Builder -->
                  Post Tests on {config-pod} triggered by build_{config-pod}_{branch} <br /><br />
                  Created from job-template {id} from ci-management/jjb/cord-test/cord-test-pipeline.yaml <br />
                  Created by Kailash Khalasi - kailash@opennetworking.org <br />
                  Copyright (c) 2017 Open Networking Foundation (ONF)

    <<: *test-pipe-job-boiler-plate

    parameters:
      - string:
         name: TestNodeName
         default: '{testvm}'
         description: 'Jenkins node name of TestVM Node'

      - string:
         name: cordRepoUrl
         default: '{gerrit-server-url}'
         description: 'The URL of the CORD Project repository'

      - string:
         name: configBaseDir
         default: 'pod-configs'
         description: 'The directory inside the POD configs repository'

      - string:
         name: configDeploymentDir
         default: 'deployment-configs'
         description: 'The deployment configs folder'

      - string:
         name: configKubernetesDir
         default: 'kubernetes-configs'
         description: 'The kubernetes config folder'

      - string:
         name: configToscaDir
         default: 'tosca-configs'
         description: 'The tosca config folder'

      - string:
         name: configFileName
         default: '{config-pod}'
         description: 'The config file'

      - string:
         name: branch
         default: '{branch}'

      - string:
         name: notificationEmail
         default: 'kailash@opennetworking.org, you@opennetworking.org, suchitra@opennetworking.org'
         description: ''

    concurrent: true

    pipeline-scm:
      script-path: '{Jenkinsfile}'
      scm:
        - git:
           url: '{gerrit-server-url}/cord-tester'
           branches:
             - '{branch}'

    triggers:
      - reverse:
          jobs: 'build_{config-pod}_seba_release_{release}_microcharts'
          result: 'success'


- job-template:
    name: 'build_{config-pod}'
    id: build_mcord_pod_manual
    description: |
                  <!-- Managed by Jenkins Job Builder -->
                  Manual Build on POD {config-pod} using {Jenkinsfile} <br /><br />
                  Created from job-template {id} from ci-management/jjb/cord-test/nightly-build-pipeline.yaml <br />
                  Created by QA (Kailash Khalasi - kailash@opennetworking.org ) <br />
                  Copyright (c) 2019 Open Networking Foundation (ONF)

    <<: *test-pipe-job-boiler-plate

    parameters:
      - string:
         name: TestNodeName
         default: '{testvm}'
         description: 'Jenkins node name of TestVM Node'

      - string:
         name: cordRepoUrl
         default: '{gerrit-server-url}'
         description: 'The URL of the CORD Project repository'

      - string:
         name: configBaseDir
         default: 'pod-configs'
         description: 'The directory inside the POD configs repository'

      - string:
         name: configDeploymentDir
         default: 'deployment-configs'
         description: 'The deployment configs folder'

      - string:
         name: configKubernetesDir
         default: 'kubernetes-configs'
         description: 'The kubernetes config folder'

      - string:
         name: configToscaDir
         default: 'tosca-configs'
         description: 'The tosca config folder'

      - string:
         name: configFileName
         default: '{config-pod}'
         description: 'The config file'

      - string:
         name: branch
         default: '{branch}'

      - string:
         name: profile
         default: '{profile}'
         description: 'Profile in which this job installs'

      - string:
         name: notificationEmail
         default: 'luca@opennetworking.org, teo@opennetworking.org, weiyu@opennetworking.org'
         description: ''

      - bool:
          name: configurePod
          default: true
          description: "Configure POD via TOSCA post build"

      - bool:
          name: installEpcControlPlane
          default: true
          description: "Install the EPC control plane"

    concurrent: true

    pipeline-scm:
      script-path: '{Jenkinsfile}'
      scm:
        - git:
           url: '{gerrit-server-url}/cord-tester'
           branches:
             - '{branch}'
