Xinyu Zhang | 59f7fee | 2021-05-21 14:04:11 +0800 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
Xinyu Zhang | 17763f4 | 2023-08-11 17:37:46 +0800 | [diff] [blame] | 2 | # Copyright (c) 2020-2023, Arm Limited. All rights reserved. |
Xinyu Zhang | 59f7fee | 2021-05-21 14:04:11 +0800 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | |
Leonardo Sandoval | 472f5d8 | 2020-11-30 11:24:13 -0600 | [diff] [blame] | 8 | - scm: |
| 9 | name: tf-m-ci-scripts |
| 10 | scm: |
| 11 | - git: |
Xinyu Zhang | 858d6da | 2023-09-26 17:38:04 +0800 | [diff] [blame] | 12 | url: ${CI_SCRIPTS_REPO} |
Leonardo Sandoval | 472f5d8 | 2020-11-30 11:24:13 -0600 | [diff] [blame] | 13 | branches: |
Xinyu Zhang | 858d6da | 2023-09-26 17:38:04 +0800 | [diff] [blame] | 14 | - ${CI_SCRIPTS_BRANCH} |
Leonardo Sandoval | 472f5d8 | 2020-11-30 11:24:13 -0600 | [diff] [blame] | 15 | basedir: tf-m-ci-scripts |
| 16 | skip-tag: true |
| 17 | shallow-clone: true |
| 18 | wipe-workspace: false |
Leonardo Sandoval | 472f5d8 | 2020-11-30 11:24:13 -0600 | [diff] [blame] | 19 | - job: |
| 20 | name: tf-m-coverity |
| 21 | node: docker-amd64-tf-m-bionic |
| 22 | project-type: freestyle |
| 23 | concurrent: true |
| 24 | disabled: false |
| 25 | defaults: global |
| 26 | description: | |
| 27 | Run the Coverity tool on Trusted Firmware M and submit the resulting |
| 28 | tarball to <a href="https://scan.coverity.com/projects/trusted-firmware-m-35b064f0-65c2-4afb-9ba9-24aa432fb7fa">Coverity Scan Online</a>. |
| 29 | <br/> |
| 30 | This job runs <b>every weekday</b> and by default uses the <b>master</b> branch on trustedfirmware.org. |
| 31 | properties: |
| 32 | - build-discarder: |
| 33 | days-to-keep: 180 |
| 34 | num-to-keep: 180 |
Leonardo Sandoval | 472f5d8 | 2020-11-30 11:24:13 -0600 | [diff] [blame] | 35 | parameters: |
| 36 | - string: |
Xinyu Zhang | 6ca1124 | 2023-08-11 17:50:47 +0800 | [diff] [blame] | 37 | name: CODE_REPO |
| 38 | default: 'https://git.trustedfirmware.org/TF-M/trusted-firmware-m' |
Leonardo Sandoval | 472f5d8 | 2020-11-30 11:24:13 -0600 | [diff] [blame] | 39 | - string: |
Xinyu Zhang | 6ca1124 | 2023-08-11 17:50:47 +0800 | [diff] [blame] | 40 | name: GERRIT_REFSPEC |
Xinyu Zhang | 8450cc9 | 2023-09-21 16:46:13 +0800 | [diff] [blame] | 41 | default: 'refs/heads/main' |
Leonardo Sandoval | 472f5d8 | 2020-11-30 11:24:13 -0600 | [diff] [blame] | 42 | - string: |
Xinyu Zhang | 6ca1124 | 2023-08-11 17:50:47 +0800 | [diff] [blame] | 43 | name: CI_SCRIPTS_REPO |
| 44 | default: 'https://git.trustedfirmware.org/ci/tf-m-ci-scripts' |
| 45 | - string: |
| 46 | name: CI_SCRIPTS_BRANCH |
Xinyu Zhang | f36e85d | 2023-09-25 12:09:55 +0800 | [diff] [blame] | 47 | default: 'master' |
Xinyu Zhang | 6ca1124 | 2023-08-11 17:50:47 +0800 | [diff] [blame] | 48 | - string: |
| 49 | name: MBEDTLS_VERSION |
| 50 | default: '' |
| 51 | - string: |
| 52 | name: MBEDTLS_URL |
| 53 | default: 'https://git.trustedfirmware.org/mirror/mbed-tls.git' |
| 54 | - string: |
| 55 | name: MCUBOOT_REFSPEC |
| 56 | default: '' |
| 57 | - string: |
| 58 | name: MCUBOOT_URL |
| 59 | default: 'https://git.trustedfirmware.org/mirror/mcuboot.git' |
| 60 | - string: |
| 61 | name: TFM_TESTS_URL |
| 62 | default: 'https://git.trustedfirmware.org/TF-M/tf-m-tests.git' |
| 63 | - string: |
| 64 | name: TFM_TESTS_REFSPEC |
| 65 | default: '' |
| 66 | - string: |
| 67 | name: TFM_EXTRAS_URL |
| 68 | default: 'https://git.trustedfirmware.org/TF-M/tf-m-extras.git' |
| 69 | - string: |
| 70 | name: TFM_EXTRAS_REFSPEC |
| 71 | default: '' |
| 72 | - string: |
| 73 | name: PSA_ARCH_TESTS_URL |
| 74 | default: 'https://git.trustedfirmware.org/mirror/psa-arch-tests.git' |
| 75 | - string: |
| 76 | name: PSA_ARCH_TESTS_VERSION |
| 77 | default: '' |
| 78 | - string: |
| 79 | name: QCBOR_URL |
| 80 | default: 'https://github.com/laurencelundblade/QCBOR.git' |
| 81 | - string: |
| 82 | name: QCBOR_VERSION |
| 83 | default: '' |
| 84 | - string: |
| 85 | name: SHARE_FOLDER |
| 86 | default: '/srv/shared/${JOB_NAME}/${BUILD_NUMBER}' |
Leonardo Sandoval | 472f5d8 | 2020-11-30 11:24:13 -0600 | [diff] [blame] | 87 | - bool: |
| 88 | name: UPLOAD_TO_COVERITY_SCAN_ONLINE |
Leonardo Sandoval | b20632f | 2021-03-12 09:11:37 -0600 | [diff] [blame] | 89 | default: true |
Leonardo Sandoval | 472f5d8 | 2020-11-30 11:24:13 -0600 | [diff] [blame] | 90 | scm: |
| 91 | - tf-m-ci-scripts |
Leonardo Sandoval | 472f5d8 | 2020-11-30 11:24:13 -0600 | [diff] [blame] | 92 | wrappers: |
| 93 | - timestamps |
| 94 | - credentials-binding: |
| 95 | - text: |
| 96 | credential-id: TF-M-COVERITY-SCAN-TOKEN |
| 97 | variable: TF_M_COVERITY_SCAN_TOKEN |
| 98 | builders: |
| 99 | - shell: |- |
| 100 | #!/bin/bash |
| 101 | set -e |
| 102 | |
Leonardo Sandoval | 472f5d8 | 2020-11-30 11:24:13 -0600 | [diff] [blame] | 103 | cd ${WORKSPACE} |
Xinyu Zhang | 6ca1124 | 2023-08-11 17:50:47 +0800 | [diff] [blame] | 104 | |
Xinyu Zhang | efc831f | 2023-08-14 13:55:38 +0800 | [diff] [blame] | 105 | # Add compiler path to sys path |
| 106 | export PATH=$GCC_10_3_PATH:${PATH} |
| 107 | |
Xinyu Zhang | 6ca1124 | 2023-08-11 17:50:47 +0800 | [diff] [blame] | 108 | # Download TF-M dependencies to avoid git clone in each config |
| 109 | ${WORKSPACE}/tf-m-ci-scripts/clone.sh |
| 110 | |
| 111 | cnt=$(ls trusted-firmware-m/lib/ext/mbedcrypto/*.patch 2> /dev/null | wc -l) |
| 112 | if [ "$cnt" != "0" ] ; then |
| 113 | cd mbedtls |
| 114 | git apply ../trusted-firmware-m/lib/ext/mbedcrypto/*.patch |
| 115 | cd - |
| 116 | fi |
| 117 | |
| 118 | # Fetch coverity tool and untar it |
Leonardo Sandoval | 472f5d8 | 2020-11-30 11:24:13 -0600 | [diff] [blame] | 119 | wget https://scan.coverity.com/download/linux64 \ |
| 120 | --quiet \ |
| 121 | --post-data "token=${TF_M_COVERITY_SCAN_TOKEN}&project=Trusted+Firmware-M" \ |
| 122 | -O coverity_tool.tgz |
| 123 | tar -xzf coverity_tool.tgz |
Xinyu Zhang | 17763f4 | 2023-08-11 17:37:46 +0800 | [diff] [blame] | 124 | mv cov-analysis-linux64* coverity |
Leonardo Sandoval | 472f5d8 | 2020-11-30 11:24:13 -0600 | [diff] [blame] | 125 | export PATH=${WORKSPACE}/coverity/bin:${PATH} |
| 126 | |
| 127 | # Run coverity |
| 128 | cd ${WORKSPACE}/trusted-firmware-m |
| 129 | ${WORKSPACE}/tf-m-ci-scripts/run-coverity.py --tf $(pwd) |
| 130 | |
| 131 | - conditional-step: |
| 132 | condition-kind: boolean-expression |
| 133 | condition-expression: "${UPLOAD_TO_COVERITY_SCAN_ONLINE}" |
| 134 | on-evaluation-failure: dont-run |
| 135 | steps: |
| 136 | - shell: |- |
| 137 | #!/bin/bash |
| 138 | |
| 139 | echo "Uploading tarball to Coverity Scan Online..." |
| 140 | cd ${WORKSPACE}/trusted-firmware-m |
| 141 | GIT_COMMIT=$(git rev-parse HEAD) |
| 142 | |
| 143 | curl \ |
| 144 | --form token=${TF_M_COVERITY_SCAN_TOKEN} \ |
Xinyu Zhang | e2904d2 | 2023-08-11 17:36:38 +0800 | [diff] [blame] | 145 | --form email=xinyu.zhang@arm.com \ |
Leonardo Sandoval | 472f5d8 | 2020-11-30 11:24:13 -0600 | [diff] [blame] | 146 | --form file=@"arm-tf-coverity-results.tgz" \ |
| 147 | --form version="Commit ${GIT_COMMIT}" \ |
| 148 | --form description="Build ${BUILD_DISPLAY_NAME}" \ |
| 149 | https://scan.coverity.com/builds?project=Trusted+Firmware-M |
| 150 | triggers: |
| 151 | - timed: H H(4-6) * * 1-5 |