tf-a-eclair-delta: New incarnation of the delta job, w/ cumulative report

This version of the job produces cumulative delta report over several
build configurations.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Change-Id: Ica8283c58b61d36196cb2ce890ac366278fa0ddb
diff --git a/tf-a-eclair-delta.yaml b/tf-a-eclair-delta.yaml
new file mode 100644
index 0000000..90e0165
--- /dev/null
+++ b/tf-a-eclair-delta.yaml
@@ -0,0 +1,165 @@
+- job:
+    name: tf-a-eclair-delta
+    node: docker-tf-a-eclair
+    project-type: freestyle
+    concurrent: true
+    disabled: false
+    defaults: global
+    Description: |
+      ECLAIR (MISRA compliance) testing of TF-A patches
+    properties:
+        - build-discarder:
+            days-to-keep: 45
+            num-to-keep: 200
+            artifact-num-to-keep: 80
+        - authorization:
+            !include: authorization.yaml.inc
+    parameters:
+        - string:
+            name: TF_CONFIG_LIST
+            default: >
+              fvp-tbb-mbedtls-rme-romlib
+              fvp-spm-spmd-lsp
+              fvp-pauth-bti-sdei
+              fvp-aarch32-roxlattables
+        - string:
+            name: MAKE_TARGET
+            default: ''
+            description: |
+              TF-A make target
+        - string:
+            name: MAKE_JOBS
+            default: '16'
+            description: |
+              --jobs to pass to make, etc.
+        - string:
+            name: DEBUG
+            default: '1'
+            description: |
+              TF-A make DEBUG setting
+        - string:
+            name: GERRIT_HOST
+            default: 'review.trustedfirmware.org'
+        - string:
+            name: GERRIT_PROJECT
+            default: 'TF-A/trusted-firmware-a'
+            description: |
+              Git project to build (also set by Gerrit trigger)
+        - string:
+            name: GERRIT_BRANCH
+            default: 'integration'
+            description: |
+              Git branch to build (also set by Gerrit trigger)
+        - string:
+            name: GERRIT_REFSPEC
+            default: ''
+        - string:
+            name: GERRIT_CHANGE_NUMBER
+            default: ''
+        - string:
+            name: GERRIT_PATCHSET_NUMBER
+            default: ''
+        - string:
+            name: MBEDTLS_URL
+            default: 'https://github.com/Mbed-TLS/mbedtls/archive/mbedtls-3.4.1.tar.gz'
+            description: |
+              URL of mbedTLS library to use in build (only for some configurations)
+        - string:
+            name: SHARE_FOLDER
+            default: '/srv/shared/${JOB_NAME}/${BUILD_NUMBER}'
+            description: 'Folder containing shared repositories for downstream pipeline jobs'
+    triggers:
+    - gerrit:
+        silent: true
+        server-name: 'review.trustedfirmware.org'
+        projects:
+        - branches:
+          - branch-compare-type: PLAIN
+            branch-pattern: integration
+          project-compare-type: PLAIN
+          project-pattern: 'TF-A/trusted-firmware-a'
+        - branches:
+          - branch-compare-type: PLAIN
+            branch-pattern: integration
+          project-compare-type: PLAIN
+          project-pattern: 'sandbox/pfalcon/trusted-firmware-a'
+        trigger-on:
+        - comment-added-event:
+            approval-category: "Allow-CI"
+            approval-value: 1
+        - comment-added-event:
+            approval-category: "Allow-CI"
+            approval-value: 2
+    wrappers:
+    - timestamps
+    - timeout:
+        timeout: 150
+        fail: true
+    - credentials-binding:
+      - ssh-user-private-key:
+          credential-id: TFA_CI_BOT_USER_SSH_KEY
+          key-file-variable: CI_BOT_KEY
+          username-variable: CI_BOT_USERNAME
+          passphrase-variable: ''
+    builders:
+    - shell: |
+        #!/bin/bash
+        set -ex
+        pwd
+        env | grep GERRIT
+        git clone https://git.trustedfirmware.org/ci/tf-a-ci-scripts.git
+        git clone https://git.trustedfirmware.org/ci/tf-ci-scripts.git
+
+        git clone https://${GERRIT_HOST}/${GERRIT_PROJECT} -b ${GERRIT_BRANCH}
+        if [ -n "${GERRIT_REFSPEC}" ]; then
+        (
+            cd $(basename ${GERRIT_PROJECT})
+            git fetch https://${GERRIT_HOST}/${GERRIT_PROJECT} ${GERRIT_REFSPEC} && git checkout FETCH_HEAD
+        )
+        fi
+        (cd trusted-firmware-a; git log --oneline -n5)
+
+        export ECLAIR_CONFIG_DIR=$PWD/tf-a-ci-scripts/eclair
+        . tf-ci-scripts/eclair/utils.sh
+        # TODO
+        #. tf-a-ci-scripts/eclair/utils_tfa.sh
+
+        . tf-a-ci-scripts/eclair/eclair_vars.sh
+
+        detachLicense 600
+        trap "returnLicense || true" EXIT
+
+        export ECLAIR_ANALYSIS=ECLAIR
+        eclair_prepare
+        eclair_analyze tf-a-ci-scripts/eclair/build-tfa-multiple.sh
+        eclair_make_ecd
+        eclair_make_reports
+
+        echo "========= Building base revision ========="
+
+        (
+            cd $(basename ${GERRIT_PROJECT})
+            git checkout HEAD^
+            git log --oneline -n5
+        )
+
+        export ECLAIR_ANALYSIS=ECLAIR_BASE
+        eclair_prepare
+        eclair_analyze tf-a-ci-scripts/eclair/build-tfa-multiple.sh
+        eclair_make_ecd
+        eclair_make_reports
+
+        eclair_make_delta_report ECLAIR_BASE ECLAIR
+        tf-ci-scripts/eclair/eclair_diff_report.py diff_output > misra_delta.txt
+
+        returnLicense
+        tf-ci-scripts/eclair/analyze_delta_index_html.sh
+        tf-ci-scripts/eclair/post_gerrit_comment.sh
+    publishers:
+        - archive:
+            artifacts: 'ECLAIR*/**, diff_output/**, misra_delta.txt, *issues_html/**, index.html'
+            excludes: 'ECLAIR/out/.data/**'
+            latest-only: false
+            allow-empty: true
+        - email:
+            recipients: 'paul.sokolovsky@linaro.org'