blob: 37307481b41076f18730d3824d3a00afa392199a [file] [log] [blame]
Leonardo Sandoval37ce1aa2020-10-16 16:56:16 -05001- job:
2 name: tf-coverity
3 node: docker-amd64-tf-a-bionic
4 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
33 default: '2020.09'
Leonardo Sandoval37ce1aa2020-10-16 16:56:16 -050034 - bool:
35 name: UPLOAD_TO_COVERITY_SCAN_ONLINE
36 default: false
Leonardo Sandovald1b6b5a2021-09-13 12:06:26 -050037 - string:
38 name: SHARE_FOLDER
39 default: '/srv/shared/${JOB_NAME}/${BUILD_NUMBER}'
40 description: 'Folder containing shared repositories for downstream pipeline jobs'
Leonardo Sandoval37ce1aa2020-10-16 16:56:16 -050041 wrappers:
42 - timestamps
43 - credentials-binding:
44 - text:
45 credential-id: TF-COVERITY-SCAN-TOKEN
46 variable: TF_COVERITY_SCAN_TOKEN
47 builders:
Leonardo Sandovald1b6b5a2021-09-13 12:06:26 -050048 - shell:
49 !include-raw: scripts/clone.sh
Fathi Boudra9c8a9452020-12-08 22:16:57 +010050 - shell: |
Leonardo Sandoval37ce1aa2020-10-16 16:56:16 -050051 #!/bin/bash
Leonardo Sandovalf950b642020-12-03 21:41:54 -060052 set -e
Leonardo Sandovalf950b642020-12-03 21:41:54 -060053 # Install crypto library
Leonardo Sandoval37ce1aa2020-10-16 16:56:16 -050054 CRYPTOCELL_LIB_PATH=/arm/projectscratch/ssg/trusted-fw
55 mkdir -p ${CRYPTOCELL_LIB_PATH}
56 cd ${CRYPTOCELL_LIB_PATH}
57 curl --connect-timeout 5 --retry 5 --retry-delay 1 \
58 -sLSO -C - https://downloads.trustedfirmware.org/tf-a/dummy-crypto-lib.tar
59 tar xf dummy-crypto-lib.tar
Leonardo Sandovalf950b642020-12-03 21:41:54 -060060 # Fetch coverity tool and untar it
Leonardo Sandoval37ce1aa2020-10-16 16:56:16 -050061 cd ${WORKSPACE}
62 wget https://scan.coverity.com/download/linux64 \
63 --quiet \
64 --post-data "token=${TF_COVERITY_SCAN_TOKEN}&project=ARM-software%2Farm-trusted-firmware" \
65 -O coverity_tool.tgz
66 tar -xzf coverity_tool.tgz
67 mv cov-analysis-linux64-${COVERITY_VERSION} coverity
68 export PATH=${WORKSPACE}/coverity/bin:${PATH}
Leonardo Sandovalf950b642020-12-03 21:41:54 -060069 # Run coverity
Leonardo Sandoval37ce1aa2020-10-16 16:56:16 -050070 cd ${WORKSPACE}/trusted-firmware-a
71 ${WORKSPACE}/tf-a-ci-scripts/script/tf-coverity/run_coverity_on_tf.py --tf $(pwd)
Leonardo Sandoval37ce1aa2020-10-16 16:56:16 -050072 - conditional-step:
73 condition-kind: boolean-expression
74 condition-expression: "${UPLOAD_TO_COVERITY_SCAN_ONLINE}"
75 on-evaluation-failure: dont-run
76 steps:
Fathi Boudra9c8a9452020-12-08 22:16:57 +010077 - shell: |
Leonardo Sandoval37ce1aa2020-10-16 16:56:16 -050078 #!/bin/bash
Leonardo Sandoval37ce1aa2020-10-16 16:56:16 -050079 echo "Uploading tarball to Coverity Scan Online..."
80 GIT_COMMIT=$(git rev-parse HEAD)
Leonardo Sandoval37ce1aa2020-10-16 16:56:16 -050081 curl \
82 --form token=${{TF_COVERITY_SCAN_TOKEN}} \
83 --form email=sandrine.bailleux@arm.com \
84 --form file=@"arm-tf-coverity-results.tgz" \
85 --form version="Commit ${{GIT_COMMIT}}" \
86 --form description="Build ${{BUILD_DISPLAY_NAME}}" \
87 https://scan.coverity.com/builds?project=ARM-software%2Farm-trusted-firmware
Leonardo Sandoval81c17c62021-01-14 16:31:28 -060088 publishers:
89 - archive:
90 artifacts: 'trusted-firmware-a/arm-tf-coverity-results.tgz, trusted-firmware-a/tf_coverage.log'
Fathi Boudra8aa4bd82021-01-15 10:30:57 +010091 - groovy-postbuild:
92 script:
93 !include-raw:
94 - tf-coverity/postbuild.groovy