blob: 9e5d817a2ebe586404565b17da27f484be8cc998 [file] [log] [blame]
Leonardo Sandoval37ce1aa2020-10-16 16:56:16 -05001- job:
Leonardo Sandovalffaee982021-11-11 10:27:57 -06002 name: tf-a-coverity
Govindraj Raja631a6ae2023-06-06 15:09:29 -05003 node: docker-amd64-tf-a-jammy
Leonardo Sandoval37ce1aa2020-10-16 16:56:16 -05004 project-type: freestyle
5 concurrent: true
6 disabled: false
7 defaults: global
8 description: |
9 Run the Coverity tool on Trusted Firmware and submit the resulting
10 tarball to <a href="https://scan.coverity.com/projects/arm-software-arm-trusted-firmware">Coverity Scan Online</a>.
11 <br/>
12 This job runs <b>every weekday</b> and by default uses the <b>integration</b> branch on trustedfirmware.org.
13 properties:
14 - build-discarder:
Leonardo Sandovala4feb552021-03-02 12:10:21 -060015 days-to-keep: 14
Leonardo Sandoval37ce1aa2020-10-16 16:56:16 -050016 - authorization:
Leonardo Sandovalebca8822021-01-25 18:20:04 -060017 !include: authorization.yaml.inc
Leonardo Sandoval37ce1aa2020-10-16 16:56:16 -050018 parameters:
19 - string:
20 name: TF_GERRIT_PROJECT
21 default: 'TF-A/trusted-firmware-a'
22 - string:
23 name: TF_GERRIT_BRANCH
24 default: 'refs/heads/integration'
25 - string:
26 name: TF_GERRIT_REFSPEC
27 default: '+refs/heads/integration:refs/remotes/origin/integration'
Leonardo Sandoval7e95c662021-02-03 12:54:51 -060028 - string:
Zelalem Awekee8801df2021-10-25 13:41:44 -050029 name: CI_REFSPEC
30 default: '+refs/heads/master:refs/remotes/origin/master'
31 - string:
Leonardo Sandoval7e95c662021-02-03 12:54:51 -060032 name: COVERITY_VERSION
Sandrine Bailleux990f2d92022-09-05 15:12:27 +020033 default: '2022.6.0'
Leonardo Sandoval37ce1aa2020-10-16 16:56:16 -050034 - bool:
35 name: UPLOAD_TO_COVERITY_SCAN_ONLINE
Sandrine Bailleux55e282f2022-11-23 08:18:27 +010036 default: true
37 description: |-
38 Whether the resulting tarball should be automatically uploaded to Coverity Scan Online.
39 <p>
40 <b style="color:red;">The number of uploads allowed on Coverity Scan Online is LIMITED.
41 Therefore, if you don't need the results to be analysed, please UNTICK this box!<b>
Leonardo Sandovald1b6b5a2021-09-13 12:06:26 -050042 - string:
43 name: SHARE_FOLDER
44 default: '/srv/shared/${JOB_NAME}/${BUILD_NUMBER}'
45 description: 'Folder containing shared repositories for downstream pipeline jobs'
Leonardo Sandoval37ce1aa2020-10-16 16:56:16 -050046 wrappers:
47 - timestamps
48 - credentials-binding:
49 - text:
50 credential-id: TF-COVERITY-SCAN-TOKEN
51 variable: TF_COVERITY_SCAN_TOKEN
52 builders:
Leonardo Sandovald1b6b5a2021-09-13 12:06:26 -050053 - shell:
54 !include-raw: scripts/clone.sh
Fathi Boudra9c8a9452020-12-08 22:16:57 +010055 - shell: |
Leonardo Sandoval37ce1aa2020-10-16 16:56:16 -050056 #!/bin/bash
Leonardo Sandovalf950b642020-12-03 21:41:54 -060057 set -e
Sandrine Bailleux0330cc42022-12-05 11:45:20 +010058 set -x
Sandrine Bailleux1b636c92022-11-22 11:01:28 +010059
Leonardo Sandovalf950b642020-12-03 21:41:54 -060060 # Install crypto library
Leonardo Sandoval37ce1aa2020-10-16 16:56:16 -050061 CRYPTOCELL_LIB_PATH=/arm/projectscratch/ssg/trusted-fw
62 mkdir -p ${CRYPTOCELL_LIB_PATH}
63 cd ${CRYPTOCELL_LIB_PATH}
64 curl --connect-timeout 5 --retry 5 --retry-delay 1 \
65 -sLSO -C - https://downloads.trustedfirmware.org/tf-a/dummy-crypto-lib.tar
66 tar xf dummy-crypto-lib.tar
Sandrine Bailleux1b636c92022-11-22 11:01:28 +010067
Leonardo Sandovalf950b642020-12-03 21:41:54 -060068 # Fetch coverity tool and untar it
Leonardo Sandoval37ce1aa2020-10-16 16:56:16 -050069 cd ${WORKSPACE}
Sandrine Bailleux5dbbe592022-12-05 14:41:44 +010070 wget https://downloads.trustedfirmware.org/tf-a/tf-a-coverity/coverity_tool.tgz
Leonardo Sandoval37ce1aa2020-10-16 16:56:16 -050071 tar -xzf coverity_tool.tgz
72 mv cov-analysis-linux64-${COVERITY_VERSION} coverity
73 export PATH=${WORKSPACE}/coverity/bin:${PATH}
Sandrine Bailleux1b636c92022-11-22 11:01:28 +010074
Leonardo Sandovalf950b642020-12-03 21:41:54 -060075 # Run coverity
Leonardo Sandoval37ce1aa2020-10-16 16:56:16 -050076 cd ${WORKSPACE}/trusted-firmware-a
77 ${WORKSPACE}/tf-a-ci-scripts/script/tf-coverity/run_coverity_on_tf.py --tf $(pwd)
Leonardo Sandoval37ce1aa2020-10-16 16:56:16 -050078 - conditional-step:
79 condition-kind: boolean-expression
80 condition-expression: "${UPLOAD_TO_COVERITY_SCAN_ONLINE}"
81 on-evaluation-failure: dont-run
82 steps:
Fathi Boudra9c8a9452020-12-08 22:16:57 +010083 - shell: |
Leonardo Sandoval37ce1aa2020-10-16 16:56:16 -050084 #!/bin/bash
Sandrine Bailleux1b636c92022-11-22 11:01:28 +010085 set -e
86
87 cd ${WORKSPACE}/trusted-firmware-a
Leonardo Sandoval37ce1aa2020-10-16 16:56:16 -050088 GIT_COMMIT=$(git rev-parse HEAD)
Sandrine Bailleux1b636c92022-11-22 11:01:28 +010089
90 echo "Uploading tarball to Coverity Scan Online..."
Leonardo Sandoval37ce1aa2020-10-16 16:56:16 -050091 curl \
Sandrine Bailleux1b636c92022-11-22 11:01:28 +010092 --form token="${TF_COVERITY_SCAN_TOKEN}" \
Leonardo Sandoval37ce1aa2020-10-16 16:56:16 -050093 --form email=sandrine.bailleux@arm.com \
94 --form file=@"arm-tf-coverity-results.tgz" \
Sandrine Bailleux1b636c92022-11-22 11:01:28 +010095 --form version="Commit ${GIT_COMMIT}" \
96 --form description="Build ${BUILD_DISPLAY_NAME}" \
Leonardo Sandoval37ce1aa2020-10-16 16:56:16 -050097 https://scan.coverity.com/builds?project=ARM-software%2Farm-trusted-firmware
Leonardo Sandoval81c17c62021-01-14 16:31:28 -060098 publishers:
99 - archive:
100 artifacts: 'trusted-firmware-a/arm-tf-coverity-results.tgz, trusted-firmware-a/tf_coverage.log'
Fathi Boudra8aa4bd82021-01-15 10:30:57 +0100101 - groovy-postbuild:
102 script:
103 !include-raw:
Leonardo Sandovalffaee982021-11-11 10:27:57 -0600104 - tf-a-coverity/postbuild.groovy
Paul Sokolovsky8299ace2023-01-07 12:27:40 +0300105 - email:
106 recipients: 'paul.sokolovsky@linaro.org'