---
# omec-ci jobs
# Uses github pull request builder to trigger and Jenkinsfiles from this repo
#  https://github.com/omec-project/omec-project-ci

# for ngic-rtc
- project:
    name: ngic-rtc
    project: '{name}'

    executor_node: 'intel-102'

    github_pr_auth_id: '64fe2b1a-b33a-4f13-8442-ad8360434003'
    github_pr_org_list:
      - 'omec-project'

    jobs:
      - 'omec-ngic-rtc-test'

- job-group:
    name: 'omec-ngic-rtc-test'
    jobs:
      - 'omec-pipeline':
          pipeline-file: 'Jenkinsfile-omec-install-ngic-rtc-vnf.groovy'
      - 'omec-tc1':
          dependency-jobs: 'omec_ngic-rtc_pipeline'
      - 'omec-tc2':
          dependency-jobs: 'omec_ngic-rtc_tc1'

# for c3po
- project:
    name: c3po
    project: '{name}'

    executor_node: 'intel-102'

    github_pr_auth_id: '64fe2b1a-b33a-4f13-8442-ad8360434003'
    github_pr_org_list:
      - 'omec-project'

    jobs:
      - 'omec-c3po-test'

- job-group:
    name: 'omec-c3po-test'
    jobs:
      - 'omec-pipeline':
          pipeline-file: 'Jenkinsfile-omec-install-c3po-vnf.groovy'
      - 'omec-tc1':
          dependency-jobs: 'omec_c3po_pipeline'
      - 'omec-tc2':
          dependency-jobs: 'omec_c3po_tc1'

# for openmme
- project:
    name: openmme
    project: '{name}'

    executor_node: 'intel-102'

    github_pr_auth_id: '64fe2b1a-b33a-4f13-8442-ad8360434003'
    github_pr_org_list:
      - 'omec-project'

    jobs:
      - 'omec-openmme-test'

- job-group:
    name: 'omec-openmme-test'
    jobs:
      - 'omec-pipeline':
          pipeline-file: 'Jenkinsfile-omec-install-openmme-vnf.groovy'
      - 'omec-tc1':
          dependency-jobs: 'omec_openmme_pipeline'
      - 'omec-tc2':
          dependency-jobs: 'omec_openmme_tc1'

# build/install pipeline job

- job-template:
    id: 'omec-pipeline'
    name: 'omec_{project}_pipeline'
    project-type: pipeline

    description: |
      <!-- Managed by Jenkins Job Builder -->
      Created by {id} job-template from ci-management/jjb/omec-ci.yaml<br />

    properties:
      - cord-infra-properties:
          build-days-to-keep: '{build-days-to-keep}'
          artifact-num-to-keep: '{artifact-num-to-keep}'
      - github:
          url: 'https://github.com/omec-project/{project}'

    wrappers:
      - lf-infra-wrappers:
          build-timeout: '{build-timeout}'
          jenkins-ssh-credential: '{jenkins-ssh-credential}'

    parameters:
      - string:
         name: executorNode
         default: '{executor_node}'
         description: 'Name of the Jenkins executor node to run the job on'

      - string:
         name: project
         default: '{project}'
         description: 'Name of the project'

    triggers:
      - cord-infra-github-pr-trigger:
          github_pr_org_list: '{obj:github_pr_org_list}'
          github_pr_auth_id: '{github_pr_auth_id}'

    concurrent: false

    pipeline-scm:
      script-path: '{pipeline-file}'
      scm:
        - git:
           url: 'https://github.com/omec-project/omec-project-ci'
           branches:
             - 'master'

# tests

- job-template:
    id: 'omec-tc1'
    name: 'omec_{project}_tc1'
    project-type: pipeline

    description: |
      <!-- Managed by Jenkins Job Builder -->
      Created by {id} job-template from ci-management/jjb/omec-ci.yaml<br />

    properties:
      - cord-infra-properties:
          build-days-to-keep: '{build-days-to-keep}'
          artifact-num-to-keep: '{artifact-num-to-keep}'
      - github:
          url: 'https://github.com/omec-project/{project}'

    wrappers:
      - lf-infra-wrappers:
          build-timeout: '{build-timeout}'
          jenkins-ssh-credential: '{jenkins-ssh-credential}'

    parameters:
      - string:
         name: executorNode
         default: '{executor_node}'
         description: 'Name of the Jenkins executor node to run the job on'

      - string:
         name: project
         default: '{project}'
         description: 'Name of the project'

    triggers:
      - cord-infra-github-pr-trigger:
          github_pr_org_list: '{obj:github_pr_org_list}'
          github_pr_auth_id: '{github_pr_auth_id}'

    concurrent: false

    pipeline-scm:
      script-path: 'Jenkinsfile-omec-test-TC1.groovy'
      scm:
        - git:
           url: 'https://github.com/omec-project/omec-project-ci'
           branches:
             - 'master'

- job-template:
    id: 'omec-tc2'
    name: 'omec_{project}_tc2'
    project-type: pipeline

    description: |
      <!-- Managed by Jenkins Job Builder -->
      Created by {id} job-template from ci-management/jjb/omec-ci.yaml<br />

    properties:
      - cord-infra-properties:
          build-days-to-keep: '{build-days-to-keep}'
          artifact-num-to-keep: '{artifact-num-to-keep}'
      - github:
          url: 'https://github.com/omec-project/{project}'

    wrappers:
      - lf-infra-wrappers:
          build-timeout: '{build-timeout}'
          jenkins-ssh-credential: '{jenkins-ssh-credential}'

    parameters:
      - string:
         name: executorNode
         default: '{executor_node}'
         description: 'Name of the Jenkins executor node to run the job on'

      - string:
         name: project
         default: '{project}'
         description: 'Name of the project'

    triggers:
      - cord-infra-github-pr-trigger:
          github_pr_org_list: '{obj:github_pr_org_list}'
          github_pr_auth_id: '{github_pr_auth_id}'

    concurrent: false

    pipeline-scm:
      script-path: 'Jenkinsfile-omec-test-TC2.groovy'
      scm:
        - git:
           url: 'https://github.com/omec-project/omec-project-ci'
           branches:
             - 'master'

