---
- project:
    name: siab-e2e-att
    project: '{name}'
    build-node: 'qct-pod4-node2'
    branch: 'master'
    refspec: 'refs/heads/master'
    failure-email-address: 'andy@opennetworking.org'
    timed-trigger: '{every-hour}'
    build-timeout: 60
    jobs:
      - 'siab-e2e-att'

- job-template:
    id: 'siab-e2e-att'
    name: 'verify_automation-tools_{project}'
    description: |
      Created by {id} job-template from ci-management/jjb/siab-e2e.yaml

    triggers:
      - timed: '{timed-trigger}'

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

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

    scm:
      - cord-infra-gerrit-scm:
          git-url: '{gerrit-server-url}/automation-tools'
          refspec: '{refspec}'
          branch: '{branch}'
          submodule-recursive: 'false'
          choosing-strategy: 'gerrit'
          jenkins-ssh-credential: '{jenkins-ssh-credential}'
          basedir: 'cord/automation-tools'

    node: '{build-node}'
    project-type: freestyle
    concurrent: false

    builders:
      - shell: |
          #!/usr/bin/env bash
          set -eu -o pipefail

          cd cord/automation-tools/seba-in-a-box
          [ -e /usr/bin/kubeadm ] && make reset-kubeadm
          make && make run-tests

    publishers:
      - email:
          recipients: '{failure-email-address}'
      - postbuildscript:
          builders:
            - role: SLAVE
              build-on:
                - SUCCESS
                - UNSTABLE
                - NOT_BUILT
                - ABORTED
                - FAILURE
              build-steps:
                - shell: sudo rm -rf /tmp/logs/*
            - role: SLAVE
              build-on:
                - FAILURE
              build-steps:
                - shell: |
                    #!/usr/bin/env bash

                    mkdir -p /tmp/logs
                    sudo cp /var/log/containers/*.log /tmp/logs
                    sudo chown cord /tmp/logs/*.log
      - archive:
          artifacts: '/tmp/logs/*.log'
          allow-empty: true
