Leonardo Sandoval | 37ce1aa | 2020-10-16 16:56:16 -0500 | [diff] [blame] | 1 | - job: |
Leonardo Sandoval | ffaee98 | 2021-11-11 10:27:57 -0600 | [diff] [blame] | 2 | name: tf-a-coverity |
Govindraj Raja | 631a6ae | 2023-06-06 15:09:29 -0500 | [diff] [blame] | 3 | node: docker-amd64-tf-a-jammy |
Leonardo Sandoval | 37ce1aa | 2020-10-16 16:56:16 -0500 | [diff] [blame] | 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 Sandoval | a4feb55 | 2021-03-02 12:10:21 -0600 | [diff] [blame] | 15 | days-to-keep: 14 |
Leonardo Sandoval | 37ce1aa | 2020-10-16 16:56:16 -0500 | [diff] [blame] | 16 | parameters: |
| 17 | - string: |
| 18 | name: TF_GERRIT_PROJECT |
| 19 | default: 'TF-A/trusted-firmware-a' |
| 20 | - string: |
| 21 | name: TF_GERRIT_BRANCH |
| 22 | default: 'refs/heads/integration' |
| 23 | - string: |
| 24 | name: TF_GERRIT_REFSPEC |
| 25 | default: '+refs/heads/integration:refs/remotes/origin/integration' |
Leonardo Sandoval | 7e95c66 | 2021-02-03 12:54:51 -0600 | [diff] [blame] | 26 | - string: |
Zelalem Aweke | e8801df | 2021-10-25 13:41:44 -0500 | [diff] [blame] | 27 | name: CI_REFSPEC |
| 28 | default: '+refs/heads/master:refs/remotes/origin/master' |
| 29 | - string: |
Saheer Babu | b495f03 | 2025-01-21 23:01:11 +0000 | [diff] [blame] | 30 | name: JOBS_REFSPEC |
| 31 | default: 'refs/heads/master' |
| 32 | description: | |
| 33 | tf-a-job-configs refspec to use. The master branch is used by default. |
| 34 | - string: |
Leonardo Sandoval | 7e95c66 | 2021-02-03 12:54:51 -0600 | [diff] [blame] | 35 | name: COVERITY_VERSION |
Madhukar Pappireddy | dbb48de | 2025-03-19 11:31:34 -0500 | [diff] [blame] | 36 | default: '2024.6.1' |
Leonardo Sandoval | 37ce1aa | 2020-10-16 16:56:16 -0500 | [diff] [blame] | 37 | - bool: |
| 38 | name: UPLOAD_TO_COVERITY_SCAN_ONLINE |
Saheer Babu | 2485892 | 2025-03-27 15:02:46 +0000 | [diff] [blame] | 39 | default: false |
Sandrine Bailleux | 55e282f | 2022-11-23 08:18:27 +0100 | [diff] [blame] | 40 | description: |- |
| 41 | Whether the resulting tarball should be automatically uploaded to Coverity Scan Online. |
| 42 | <p> |
| 43 | <b style="color:red;">The number of uploads allowed on Coverity Scan Online is LIMITED. |
| 44 | Therefore, if you don't need the results to be analysed, please UNTICK this box!<b> |
Leonardo Sandoval | d1b6b5a | 2021-09-13 12:06:26 -0500 | [diff] [blame] | 45 | - string: |
| 46 | name: SHARE_FOLDER |
| 47 | default: '/srv/shared/${JOB_NAME}/${BUILD_NUMBER}' |
| 48 | description: 'Folder containing shared repositories for downstream pipeline jobs' |
Leonardo Sandoval | 37ce1aa | 2020-10-16 16:56:16 -0500 | [diff] [blame] | 49 | wrappers: |
| 50 | - timestamps |
| 51 | - credentials-binding: |
| 52 | - text: |
| 53 | credential-id: TF-COVERITY-SCAN-TOKEN |
| 54 | variable: TF_COVERITY_SCAN_TOKEN |
| 55 | builders: |
Leonardo Sandoval | d1b6b5a | 2021-09-13 12:06:26 -0500 | [diff] [blame] | 56 | - shell: |
| 57 | !include-raw: scripts/clone.sh |
Fathi Boudra | 9c8a945 | 2020-12-08 22:16:57 +0100 | [diff] [blame] | 58 | - shell: | |
Leonardo Sandoval | 37ce1aa | 2020-10-16 16:56:16 -0500 | [diff] [blame] | 59 | #!/bin/bash |
Leonardo Sandoval | f950b64 | 2020-12-03 21:41:54 -0600 | [diff] [blame] | 60 | set -e |
Sandrine Bailleux | 0330cc4 | 2022-12-05 11:45:20 +0100 | [diff] [blame] | 61 | set -x |
Sandrine Bailleux | 1b636c9 | 2022-11-22 11:01:28 +0100 | [diff] [blame] | 62 | |
Leonardo Sandoval | f950b64 | 2020-12-03 21:41:54 -0600 | [diff] [blame] | 63 | # Fetch coverity tool and untar it |
Leonardo Sandoval | 37ce1aa | 2020-10-16 16:56:16 -0500 | [diff] [blame] | 64 | cd ${WORKSPACE} |
Saheer Babu | 24fcaf9 | 2025-02-10 11:01:44 +0000 | [diff] [blame] | 65 | wget ${DOWNLOAD_SERVER_URL}/tf-a/tf-a-coverity/coverity_tool.tgz |
Leonardo Sandoval | 37ce1aa | 2020-10-16 16:56:16 -0500 | [diff] [blame] | 66 | tar -xzf coverity_tool.tgz |
| 67 | mv cov-analysis-linux64-${COVERITY_VERSION} coverity |
| 68 | export PATH=${WORKSPACE}/coverity/bin:${PATH} |
Sandrine Bailleux | 1b636c9 | 2022-11-22 11:01:28 +0100 | [diff] [blame] | 69 | |
Leonardo Sandoval | f950b64 | 2020-12-03 21:41:54 -0600 | [diff] [blame] | 70 | # Run coverity |
Leonardo Sandoval | 37ce1aa | 2020-10-16 16:56:16 -0500 | [diff] [blame] | 71 | cd ${WORKSPACE}/trusted-firmware-a |
| 72 | ${WORKSPACE}/tf-a-ci-scripts/script/tf-coverity/run_coverity_on_tf.py --tf $(pwd) |
Leonardo Sandoval | 37ce1aa | 2020-10-16 16:56:16 -0500 | [diff] [blame] | 73 | - conditional-step: |
| 74 | condition-kind: boolean-expression |
| 75 | condition-expression: "${UPLOAD_TO_COVERITY_SCAN_ONLINE}" |
| 76 | on-evaluation-failure: dont-run |
| 77 | steps: |
Fathi Boudra | 9c8a945 | 2020-12-08 22:16:57 +0100 | [diff] [blame] | 78 | - shell: | |
Leonardo Sandoval | 37ce1aa | 2020-10-16 16:56:16 -0500 | [diff] [blame] | 79 | #!/bin/bash |
Sandrine Bailleux | 1b636c9 | 2022-11-22 11:01:28 +0100 | [diff] [blame] | 80 | set -e |
| 81 | |
| 82 | cd ${WORKSPACE}/trusted-firmware-a |
Leonardo Sandoval | 37ce1aa | 2020-10-16 16:56:16 -0500 | [diff] [blame] | 83 | GIT_COMMIT=$(git rev-parse HEAD) |
Sandrine Bailleux | 1b636c9 | 2022-11-22 11:01:28 +0100 | [diff] [blame] | 84 | |
| 85 | echo "Uploading tarball to Coverity Scan Online..." |
Leonardo Sandoval | 37ce1aa | 2020-10-16 16:56:16 -0500 | [diff] [blame] | 86 | curl \ |
Sandrine Bailleux | 1b636c9 | 2022-11-22 11:01:28 +0100 | [diff] [blame] | 87 | --form token="${TF_COVERITY_SCAN_TOKEN}" \ |
Leonardo Sandoval | 37ce1aa | 2020-10-16 16:56:16 -0500 | [diff] [blame] | 88 | --form email=sandrine.bailleux@arm.com \ |
| 89 | --form file=@"arm-tf-coverity-results.tgz" \ |
Sandrine Bailleux | 1b636c9 | 2022-11-22 11:01:28 +0100 | [diff] [blame] | 90 | --form version="Commit ${GIT_COMMIT}" \ |
| 91 | --form description="Build ${BUILD_DISPLAY_NAME}" \ |
Leonardo Sandoval | 37ce1aa | 2020-10-16 16:56:16 -0500 | [diff] [blame] | 92 | https://scan.coverity.com/builds?project=ARM-software%2Farm-trusted-firmware |
Leonardo Sandoval | 81c17c6 | 2021-01-14 16:31:28 -0600 | [diff] [blame] | 93 | publishers: |
| 94 | - archive: |
| 95 | artifacts: 'trusted-firmware-a/arm-tf-coverity-results.tgz, trusted-firmware-a/tf_coverage.log' |
Fathi Boudra | 8aa4bd8 | 2021-01-15 10:30:57 +0100 | [diff] [blame] | 96 | - groovy-postbuild: |
| 97 | script: |
| 98 | !include-raw: |
Leonardo Sandoval | ffaee98 | 2021-11-11 10:27:57 -0600 | [diff] [blame] | 99 | - tf-a-coverity/postbuild.groovy |