blob: 9865872e032a8c483da08a2187d4b64f325ff33c [file] [log] [blame]
Xinyu Zhang59f7fee2021-05-21 14:04:11 +08001#-------------------------------------------------------------------------------
Xinyu Zhang17763f42023-08-11 17:37:46 +08002# Copyright (c) 2020-2023, Arm Limited. All rights reserved.
Xinyu Zhang59f7fee2021-05-21 14:04:11 +08003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
Leonardo Sandoval472f5d82020-11-30 11:24:13 -06008- scm:
9 name: tf-m-ci-scripts
10 scm:
11 - git:
Xinyu Zhang858d6da2023-09-26 17:38:04 +080012 url: ${CI_SCRIPTS_REPO}
Leonardo Sandoval472f5d82020-11-30 11:24:13 -060013 branches:
Xinyu Zhang858d6da2023-09-26 17:38:04 +080014 - ${CI_SCRIPTS_BRANCH}
Leonardo Sandoval472f5d82020-11-30 11:24:13 -060015 basedir: tf-m-ci-scripts
16 skip-tag: true
17 shallow-clone: true
18 wipe-workspace: false
Leonardo Sandoval472f5d82020-11-30 11:24:13 -060019- 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 Sandoval472f5d82020-11-30 11:24:13 -060035 parameters:
36 - string:
Xinyu Zhang6ca11242023-08-11 17:50:47 +080037 name: CODE_REPO
38 default: 'https://git.trustedfirmware.org/TF-M/trusted-firmware-m'
Leonardo Sandoval472f5d82020-11-30 11:24:13 -060039 - string:
Xinyu Zhang6ca11242023-08-11 17:50:47 +080040 name: GERRIT_REFSPEC
Xinyu Zhang8450cc92023-09-21 16:46:13 +080041 default: 'refs/heads/main'
Leonardo Sandoval472f5d82020-11-30 11:24:13 -060042 - string:
Xinyu Zhang6ca11242023-08-11 17:50:47 +080043 name: CI_SCRIPTS_REPO
44 default: 'https://git.trustedfirmware.org/ci/tf-m-ci-scripts'
45 - string:
46 name: CI_SCRIPTS_BRANCH
Xinyu Zhangf36e85d2023-09-25 12:09:55 +080047 default: 'master'
Xinyu Zhang6ca11242023-08-11 17:50:47 +080048 - 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 Sandoval472f5d82020-11-30 11:24:13 -060087 - bool:
88 name: UPLOAD_TO_COVERITY_SCAN_ONLINE
Leonardo Sandovalb20632f2021-03-12 09:11:37 -060089 default: true
Leonardo Sandoval472f5d82020-11-30 11:24:13 -060090 scm:
91 - tf-m-ci-scripts
Leonardo Sandoval472f5d82020-11-30 11:24:13 -060092 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 Sandoval472f5d82020-11-30 11:24:13 -0600103 cd ${WORKSPACE}
Xinyu Zhang6ca11242023-08-11 17:50:47 +0800104
Xinyu Zhangefc831f2023-08-14 13:55:38 +0800105 # Add compiler path to sys path
106 export PATH=$GCC_10_3_PATH:${PATH}
107
Xinyu Zhang6ca11242023-08-11 17:50:47 +0800108 # 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 Sandoval472f5d82020-11-30 11:24:13 -0600119 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 Zhang17763f42023-08-11 17:37:46 +0800124 mv cov-analysis-linux64* coverity
Leonardo Sandoval472f5d82020-11-30 11:24:13 -0600125 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 Zhange2904d22023-08-11 17:36:38 +0800145 --form email=xinyu.zhang@arm.com \
Leonardo Sandoval472f5d82020-11-30 11:24:13 -0600146 --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