- job:
    name: infrastructure-ansible-playbook
    project-type: freestyle
    defaults: global
    logrotate:
        daysToKeep: 30
        numToKeep: 30
    properties:
        - authorization:
            anonymous:
                - job-read
                - job-extended-read
            everyone-flat:
                - job-build
                - job-cancel
    disabled: false
    node: triggers
    display-name: 'Infrastructure - Unit Test for the ansible-playbooks repository'
    concurrent: true
    triggers:
        - gerrit:
            server-name: 'review.linaro.org'
            override-votes: true
            gerrit-build-successful-verified-value: 1
            gerrit-build-failed-verified-value: -1
            trigger-for-unreviewed-patches: true
            readable-message: false
            projects:
                - project-compare-type: 'PLAIN'
                  project-pattern: 'infrastructure/ansible-playbooks'
                  branches:
                    - branch-compare-type: 'PLAIN'
                      branch-pattern: 'master'
    wrappers:
        - timeout:
            timeout: 300
        - timestamps
    builders:
        - shell: |
            #!/bin/bash
            set -e

            rm -rf ansible-playbooks
            git clone https://git.linaro.org/$GERRIT_PROJECT -b $GERRIT_BRANCH
            cd *
            git log -n1
            git fetch https://review.linaro.org/$GERRIT_PROJECT $GERRIT_REFSPEC && git checkout FETCH_HEAD
            bash ./tests/ansible-lint-test.sh
