blob: e1b8385f53751d28755f8a81bad83a53b938eeb7 [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:
12 url: https://git.trustedfirmware.org/ci/tf-m-ci-scripts.git
Xinyu Zhang8450cc92023-09-21 16:46:13 +080013 refspec: +refs/heads/main:refs/remotes/origin/master
Leonardo Sandoval472f5d82020-11-30 11:24:13 -060014 name: origin
15 branches:
Xinyu Zhang8450cc92023-09-21 16:46:13 +080016 - refs/heads/main
Leonardo Sandoval472f5d82020-11-30 11:24:13 -060017 basedir: tf-m-ci-scripts
18 skip-tag: true
19 shallow-clone: true
20 wipe-workspace: false
Leonardo Sandoval472f5d82020-11-30 11:24:13 -060021- job:
22 name: tf-m-coverity
23 node: docker-amd64-tf-m-bionic
24 project-type: freestyle
25 concurrent: true
26 disabled: false
27 defaults: global
28 description: |
29 Run the Coverity tool on Trusted Firmware M and submit the resulting
30 tarball to <a href="https://scan.coverity.com/projects/trusted-firmware-m-35b064f0-65c2-4afb-9ba9-24aa432fb7fa">Coverity Scan Online</a>.
31 <br/>
32 This job runs <b>every weekday</b> and by default uses the <b>master</b> branch on trustedfirmware.org.
33 properties:
34 - build-discarder:
35 days-to-keep: 180
36 num-to-keep: 180
Leonardo Sandoval472f5d82020-11-30 11:24:13 -060037 parameters:
38 - string:
Xinyu Zhang6ca11242023-08-11 17:50:47 +080039 name: CODE_REPO
40 default: 'https://git.trustedfirmware.org/TF-M/trusted-firmware-m'
Leonardo Sandoval472f5d82020-11-30 11:24:13 -060041 - string:
Xinyu Zhang6ca11242023-08-11 17:50:47 +080042 name: GERRIT_REFSPEC
Xinyu Zhang8450cc92023-09-21 16:46:13 +080043 default: 'refs/heads/main'
Leonardo Sandoval472f5d82020-11-30 11:24:13 -060044 - string:
Xinyu Zhang6ca11242023-08-11 17:50:47 +080045 name: CI_SCRIPTS_REPO
46 default: 'https://git.trustedfirmware.org/ci/tf-m-ci-scripts'
47 - string:
48 name: CI_SCRIPTS_BRANCH
Xinyu Zhangf36e85d2023-09-25 12:09:55 +080049 default: 'master'
Xinyu Zhang6ca11242023-08-11 17:50:47 +080050 - string:
51 name: MBEDTLS_VERSION
52 default: ''
53 - string:
54 name: MBEDTLS_URL
55 default: 'https://git.trustedfirmware.org/mirror/mbed-tls.git'
56 - string:
57 name: MCUBOOT_REFSPEC
58 default: ''
59 - string:
60 name: MCUBOOT_URL
61 default: 'https://git.trustedfirmware.org/mirror/mcuboot.git'
62 - string:
63 name: TFM_TESTS_URL
64 default: 'https://git.trustedfirmware.org/TF-M/tf-m-tests.git'
65 - string:
66 name: TFM_TESTS_REFSPEC
67 default: ''
68 - string:
69 name: TFM_EXTRAS_URL
70 default: 'https://git.trustedfirmware.org/TF-M/tf-m-extras.git'
71 - string:
72 name: TFM_EXTRAS_REFSPEC
73 default: ''
74 - string:
75 name: PSA_ARCH_TESTS_URL
76 default: 'https://git.trustedfirmware.org/mirror/psa-arch-tests.git'
77 - string:
78 name: PSA_ARCH_TESTS_VERSION
79 default: ''
80 - string:
81 name: QCBOR_URL
82 default: 'https://github.com/laurencelundblade/QCBOR.git'
83 - string:
84 name: QCBOR_VERSION
85 default: ''
86 - string:
87 name: SHARE_FOLDER
88 default: '/srv/shared/${JOB_NAME}/${BUILD_NUMBER}'
Leonardo Sandoval472f5d82020-11-30 11:24:13 -060089 - bool:
90 name: UPLOAD_TO_COVERITY_SCAN_ONLINE
Leonardo Sandovalb20632f2021-03-12 09:11:37 -060091 default: true
Leonardo Sandoval472f5d82020-11-30 11:24:13 -060092 scm:
93 - tf-m-ci-scripts
Leonardo Sandoval472f5d82020-11-30 11:24:13 -060094 wrappers:
95 - timestamps
96 - credentials-binding:
97 - text:
98 credential-id: TF-M-COVERITY-SCAN-TOKEN
99 variable: TF_M_COVERITY_SCAN_TOKEN
100 builders:
101 - shell: |-
102 #!/bin/bash
103 set -e
104
Leonardo Sandoval472f5d82020-11-30 11:24:13 -0600105 cd ${WORKSPACE}
Xinyu Zhang6ca11242023-08-11 17:50:47 +0800106
Xinyu Zhangefc831f2023-08-14 13:55:38 +0800107 # Add compiler path to sys path
108 export PATH=$GCC_10_3_PATH:${PATH}
109
Xinyu Zhang6ca11242023-08-11 17:50:47 +0800110 # Download TF-M dependencies to avoid git clone in each config
111 ${WORKSPACE}/tf-m-ci-scripts/clone.sh
112
113 cnt=$(ls trusted-firmware-m/lib/ext/mbedcrypto/*.patch 2> /dev/null | wc -l)
114 if [ "$cnt" != "0" ] ; then
115 cd mbedtls
116 git apply ../trusted-firmware-m/lib/ext/mbedcrypto/*.patch
117 cd -
118 fi
119
120 # Fetch coverity tool and untar it
Leonardo Sandoval472f5d82020-11-30 11:24:13 -0600121 wget https://scan.coverity.com/download/linux64 \
122 --quiet \
123 --post-data "token=${TF_M_COVERITY_SCAN_TOKEN}&project=Trusted+Firmware-M" \
124 -O coverity_tool.tgz
125 tar -xzf coverity_tool.tgz
Xinyu Zhang17763f42023-08-11 17:37:46 +0800126 mv cov-analysis-linux64* coverity
Leonardo Sandoval472f5d82020-11-30 11:24:13 -0600127 export PATH=${WORKSPACE}/coverity/bin:${PATH}
128
129 # Run coverity
130 cd ${WORKSPACE}/trusted-firmware-m
131 ${WORKSPACE}/tf-m-ci-scripts/run-coverity.py --tf $(pwd)
132
133 - conditional-step:
134 condition-kind: boolean-expression
135 condition-expression: "${UPLOAD_TO_COVERITY_SCAN_ONLINE}"
136 on-evaluation-failure: dont-run
137 steps:
138 - shell: |-
139 #!/bin/bash
140
141 echo "Uploading tarball to Coverity Scan Online..."
142 cd ${WORKSPACE}/trusted-firmware-m
143 GIT_COMMIT=$(git rev-parse HEAD)
144
145 curl \
146 --form token=${TF_M_COVERITY_SCAN_TOKEN} \
Xinyu Zhange2904d22023-08-11 17:36:38 +0800147 --form email=xinyu.zhang@arm.com \
Leonardo Sandoval472f5d82020-11-30 11:24:13 -0600148 --form file=@"arm-tf-coverity-results.tgz" \
149 --form version="Commit ${GIT_COMMIT}" \
150 --form description="Build ${BUILD_DISPLAY_NAME}" \
151 https://scan.coverity.com/builds?project=Trusted+Firmware-M
152 triggers:
153 - timed: H H(4-6) * * 1-5