- job:
    name: tcwg-compare-results-gerrit
    project-type: freestyle
    defaults: global
    properties:
        - authorization:
            anonymous:
                - job-read
                - job-extended-read
            everyone-flat:
                - job-build
                - job-cancel
        - build-discarder:
            days-to-keep: 30
            num-to-keep: 60
    disabled: false
    node: tcwg-x86_64-dev-01
    retry-count: 3
    concurrent: true
    display-name: 'TCWG Gerrit Compare results'
    scm:
        - git:
            url: https://gitlab.com/LinaroLtd/tcwg/gcc-compare-results.git
            refspec: ${GERRIT_REFSPEC}
            branches:
                - ${GERRIT_BRANCH}
            skip-tag: true
            wipe-workspace: true
            choosing-strategy: gerrit
    triggers:
        - gerrit:
            server-name: 'review.linaro.org'
            override-votes: true
            gerrit-build-successful-verified-value: 1
            gerrit-build-failed-verified-value: -1
            gerrit-build-successful-codereview-value: 1
            gerrit-build-failed-codereview-value: -1
            readable-message: true
            successful-message: 'Sanity check OK'
            failure-message: 'Sanity check FAIL'
            trigger-for-unreviewed-patches: true
            projects:
                - project-compare-type: 'PLAIN'
                  project-pattern: 'toolchain/gcc-compare-results'
                  branches:
                    - branch-compare-type: 'ANT'
                      branch-pattern: '**'
    wrappers:
        - timeout:
            timeout: 3000
        - timestamps
        - ssh-agent-credentials:
            # tcwg-buildslave user id
            users:
                - 'e0958a95-204f-4c14-a66c-5e2be6c5d50a'
        - build-name:
            name: '#${BUILD_NUMBER}-${ENV,var="GERRIT_PATCHSET_REVISION"}'
    builders:
        - shell: |
            #!/bin/bash

            set -e
            set -x

            make -C testsuite check
