---
- job-template:
    name: '{project-name}-{stream}-{subproject}-docker-merge'
    id: integration-docker-merge
    project-type: freestyle
    node: 'ubuntu1804-docker-8c-8g'
    docker-image-name: ''
    mvn-goals: 'clean package docker:build docker:push'

    properties:
      - infra-properties:
          build-days-to-keep: '{build-days-to-keep}'

    parameters:
      - infra-parameters:
          project: '{project}'
          branch: '{branch}'
          refspec: 'refs/heads/{branch}'
          artifacts: '{archive-artifacts}'
      - maven-exec:
          maven-version: '{maven-version}'
      - docker-image-name:
          docker-image-name: '{docker-image-name}'

    scm:
      - gerrit-trigger-scm:
          refspec: ''
          choosing-strategy: 'default'
          submodule-recursive: '{submodule-recursive}'

    wrappers:
      - infra-wrappers:
          build-timeout: '{build-timeout}'

    triggers:
      - gerrit-trigger-patch-merged:
          server: '{server-name}'
          project: '{project}'
          branch: '{branch}'
          files: '{pattern}'

    builders:
      - provide-maven-settings:
          global-settings-file: 'global-settings'
          settings-file: '{mvn-settings}'

      - docker-login

      - maven-target:
          maven-version: '{maven-version}'
          pom: '{pom}'
          goals: '{mvn-goals}'
          settings: '{mvn-settings}'
          settings-type: cfp
          global-settings: 'global-settings'
          global-settings-type: cfp
          properties:
            - docker.pull.registry=nexus3.onap.org:10001
            - docker.push.registry=nexus3.onap.org:10003

    publishers:
      - lf-infra-publish

- job-template:
    name: '{project-name}-{stream}-{subproject}-docker-verify'
    id: integration-docker-verify
    project-type: freestyle
    node: 'ubuntu1804-docker-8c-8g'
    docker-image-name: ''
    mvn-goals: 'clean package docker:build'
    post-docker-verify-script: ''

    properties:
      - infra-properties:
          build-days-to-keep: '{build-days-to-keep}'

    parameters:
      - infra-parameters:
          project: '{project}'
          branch: '{branch}'
          refspec: 'refs/heads/{branch}'
          artifacts: '{archive-artifacts}'
      - maven-exec:
          maven-version: '{maven-version}'
      - docker-image-name:
          docker-image-name: '{docker-image-name}'

    scm:
      - gerrit-trigger-scm:
          refspec: '$GERRIT_REFSPEC'
          choosing-strategy: 'gerrit'
          submodule-recursive: '{submodule-recursive}'

    wrappers:
      - infra-wrappers:
          build-timeout: '{build-timeout}'

    triggers:
      - gerrit-trigger-patch-submitted:
          server: '{server-name}'
          project: '{project}'
          branch: '{branch}'
          files: '{pattern}'

    builders:
      - provide-maven-settings:
          global-settings-file: 'global-settings'
          settings-file: '{mvn-settings}'

      - docker-login

      - maven-target:
          maven-version: '{maven-version}'
          pom: '{pom}'
          goals: '{mvn-goals}'
          settings: '{mvn-settings}'
          settings-type: cfp
          global-settings: 'global-settings'
          global-settings-type: cfp
          properties:
            - docker.pull.registry=nexus3.onap.org:10001
            - docker.push.registry=nexus3.onap.org:10003
      - shell: '{post-docker-verify-script}'

    publishers:
      - lf-infra-publish

- job-template:
    name: '{project-name}-{stream}-{subproject}-docker-compose-verify'
    id: integration-docker-compose-verify
    project-type: freestyle
    description: 'This job validates Docker Compose based projects'
    node: 'ubuntu1804-docker-8c-8g'
    docker_root: '$WORKSPACE'
    post_script: ''
    netconf_sim_service_name: ''

    parameters:
      - lf-infra-parameters:
          project: '{project}'
          stream: '{stream}'
          branch: '{branch}'

    properties:
      - infra-properties:
          build-days-to-keep: '{build-days-to-keep}'

    scm:
      - gerrit-trigger-scm:
          refspec: '$GERRIT_REFSPEC'
          choosing-strategy: 'gerrit'
          submodule-recursive: '{submodule-recursive}'

    wrappers:
      - infra-wrappers:
          build-timeout: '{build-timeout}'

    triggers:
      - gerrit-trigger-patch-submitted:
          server: '{server-name}'
          project: '{project}'
          branch: '{branch}'
          files: '{pattern}'

    builders:
      - inject:
          properties-content: |
            DOCKER_ROOT={docker_root}
            NETCONF_SIM_SERVICE_NAME={netconf_sim_service_name}
      - shell: '{script}'
      - shell: '{post_script}'

    publishers:
      - integration-docker-compose-logs
      - lf-infra-publish