- defaults:
    name: global
    description: |
        JJB template: {template-name}

- wrapper:
    name: timeout-wrapper
    wrappers:
      - timeout:
          fail: true
          elastic-percentage: 150
          elastic-default-timeout: 90
          type: elastic

- wrapper:
    name: pre-scm-shell-ant
    wrappers:
      - pre-scm-buildstep:
          buildsteps:
            - shell: |
                #!/bin/bash
                echo "Doing somethiung cool"
            - shell: |
                #!/bin/zsh
                echo "Doing somethin cool with zsh"
            - ant:
                targets: "target1 target2"
                ant-name: "Standard Ant"
            - inject:
                properties-file: example.prop
                properties-content: EXAMPLE=foo-bar

- wrapper:
    name: copy-files
    wrappers:
      - copy-to-slave:
          includes:
            - file1
            - file2*.txt
          excludes:
            - file2bad.txt

- trigger:
    name: gerrit-review
    triggers:
      - gerrit:
         trigger-on-patchset-uploaded-event: true
         trigger-on-change-merged-event: false
         trigger-on-ref-updated-event: false
         trigger-on-comment-added-event: false
         override-votes: true
         gerrit-build-started-verified-value: 0
         gerrit-build-successful-verified-value: 1
         gerrit-build-failed-verified-value: -1
         gerrit-build-unstable-verified-value: -1
         gerrit-build-notbuilt-verified-value: -1
         gerrit-build-started-codereview-value: 0
         gerrit-build-successful-codereview-value: 1
         gerrit-build-failed-codereview-value: -1
         gerrit-build-unstable-codereview-value: -1
         gerrit-build-notbuilt-codereview-value: -1
         gerrit-build-aborted-verified-value: 0
         gerrit-build-aborted-codereview-value: 0
         projects:
           - project-compare-type: 'PLAIN'
             project-pattern: '{project_pattern}'
             branches:
               - branch-compare-type: 'ANT'
                 branch-pattern: '**'
         start-message: 'Start message.'
         failure-message: 'Failed message.'
         successful-message: 'Success message.'
         unstable-message: 'Unstable message.'
         notbuilt-message: 'Not built message.'
         aborted-message: 'Aborted message.'

- scm:
    name: gerrit-scm
    scm:
      - git:
         url: ssh://jenkins@review.openstack.org:29418/{project_pattern}.git
         branches:
          - origin/**
         name: origin
         prune: true
         clean: true
         browser: gitweb
         browser-url: http://review.openstack.org/gitweb?p={project_pattern}.git
         choosing-strategy: gerrit
         lfs-pull: true

- project:
    name: complete001
    version:
        - 1.2
    jobs:
        - 'complete001'

- job-template:
    name: 'complete001_{version}'
    id: 'complete001'
    scm:
      - gerrit-scm:
         project_pattern: openstack-infra/jenkins-job-builder
    triggers:
      - gerrit-review:
         project_pattern: openstack-infra/jenkins-job-builder
    wrappers:
      - timeout-wrapper
      - pre-scm-shell-ant
      - copy-files
    builders:
      - shell: 'echo JJB template: {template-name}'
      - shell: |
         #!/usr/bin/env python
         #
         print("Doing something cool with python")
