Leonardo Sandoval | 37ce1aa | 2020-10-16 16:56:16 -0500 | [diff] [blame] | 1 | - 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 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 | - authorization: |
Leonardo Sandoval | ebca882 | 2021-01-25 18:20:04 -0600 | [diff] [blame] | 17 | !include: authorization.yaml.inc |
Leonardo Sandoval | 37ce1aa | 2020-10-16 16:56:16 -0500 | [diff] [blame] | 18 | 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 Sandoval | 7e95c66 | 2021-02-03 12:54:51 -0600 | [diff] [blame] | 28 | - string: |
| 29 | name: COVERITY_VERSION |
| 30 | default: '2020.09' |
Leonardo Sandoval | 37ce1aa | 2020-10-16 16:56:16 -0500 | [diff] [blame] | 31 | - bool: |
| 32 | name: UPLOAD_TO_COVERITY_SCAN_ONLINE |
| 33 | default: false |
Leonardo Sandoval | d1b6b5a | 2021-09-13 12:06:26 -0500 | [diff] [blame^] | 34 | - string: |
| 35 | name: SHARE_FOLDER |
| 36 | default: '/srv/shared/${JOB_NAME}/${BUILD_NUMBER}' |
| 37 | description: 'Folder containing shared repositories for downstream pipeline jobs' |
Leonardo Sandoval | 37ce1aa | 2020-10-16 16:56:16 -0500 | [diff] [blame] | 38 | wrappers: |
| 39 | - timestamps |
| 40 | - credentials-binding: |
| 41 | - text: |
| 42 | credential-id: TF-COVERITY-SCAN-TOKEN |
| 43 | variable: TF_COVERITY_SCAN_TOKEN |
| 44 | builders: |
Leonardo Sandoval | d1b6b5a | 2021-09-13 12:06:26 -0500 | [diff] [blame^] | 45 | - shell: |
| 46 | !include-raw: scripts/clone.sh |
Fathi Boudra | 9c8a945 | 2020-12-08 22:16:57 +0100 | [diff] [blame] | 47 | - shell: | |
Leonardo Sandoval | 37ce1aa | 2020-10-16 16:56:16 -0500 | [diff] [blame] | 48 | #!/bin/bash |
Leonardo Sandoval | f950b64 | 2020-12-03 21:41:54 -0600 | [diff] [blame] | 49 | set -e |
Leonardo Sandoval | f950b64 | 2020-12-03 21:41:54 -0600 | [diff] [blame] | 50 | # Install crypto library |
Leonardo Sandoval | 37ce1aa | 2020-10-16 16:56:16 -0500 | [diff] [blame] | 51 | CRYPTOCELL_LIB_PATH=/arm/projectscratch/ssg/trusted-fw |
| 52 | mkdir -p ${CRYPTOCELL_LIB_PATH} |
| 53 | cd ${CRYPTOCELL_LIB_PATH} |
| 54 | curl --connect-timeout 5 --retry 5 --retry-delay 1 \ |
| 55 | -sLSO -C - https://downloads.trustedfirmware.org/tf-a/dummy-crypto-lib.tar |
| 56 | tar xf dummy-crypto-lib.tar |
Leonardo Sandoval | f950b64 | 2020-12-03 21:41:54 -0600 | [diff] [blame] | 57 | # Fetch coverity tool and untar it |
Leonardo Sandoval | 37ce1aa | 2020-10-16 16:56:16 -0500 | [diff] [blame] | 58 | cd ${WORKSPACE} |
| 59 | wget https://scan.coverity.com/download/linux64 \ |
| 60 | --quiet \ |
| 61 | --post-data "token=${TF_COVERITY_SCAN_TOKEN}&project=ARM-software%2Farm-trusted-firmware" \ |
| 62 | -O coverity_tool.tgz |
| 63 | tar -xzf coverity_tool.tgz |
| 64 | mv cov-analysis-linux64-${COVERITY_VERSION} coverity |
| 65 | export PATH=${WORKSPACE}/coverity/bin:${PATH} |
Leonardo Sandoval | f950b64 | 2020-12-03 21:41:54 -0600 | [diff] [blame] | 66 | # Run coverity |
Leonardo Sandoval | 37ce1aa | 2020-10-16 16:56:16 -0500 | [diff] [blame] | 67 | cd ${WORKSPACE}/trusted-firmware-a |
| 68 | ${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] | 69 | - conditional-step: |
| 70 | condition-kind: boolean-expression |
| 71 | condition-expression: "${UPLOAD_TO_COVERITY_SCAN_ONLINE}" |
| 72 | on-evaluation-failure: dont-run |
| 73 | steps: |
Fathi Boudra | 9c8a945 | 2020-12-08 22:16:57 +0100 | [diff] [blame] | 74 | - shell: | |
Leonardo Sandoval | 37ce1aa | 2020-10-16 16:56:16 -0500 | [diff] [blame] | 75 | #!/bin/bash |
Leonardo Sandoval | 37ce1aa | 2020-10-16 16:56:16 -0500 | [diff] [blame] | 76 | echo "Uploading tarball to Coverity Scan Online..." |
| 77 | GIT_COMMIT=$(git rev-parse HEAD) |
Leonardo Sandoval | 37ce1aa | 2020-10-16 16:56:16 -0500 | [diff] [blame] | 78 | curl \ |
| 79 | --form token=${{TF_COVERITY_SCAN_TOKEN}} \ |
| 80 | --form email=sandrine.bailleux@arm.com \ |
| 81 | --form file=@"arm-tf-coverity-results.tgz" \ |
| 82 | --form version="Commit ${{GIT_COMMIT}}" \ |
| 83 | --form description="Build ${{BUILD_DISPLAY_NAME}}" \ |
| 84 | https://scan.coverity.com/builds?project=ARM-software%2Farm-trusted-firmware |
Leonardo Sandoval | 81c17c6 | 2021-01-14 16:31:28 -0600 | [diff] [blame] | 85 | publishers: |
| 86 | - archive: |
| 87 | 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] | 88 | - groovy-postbuild: |
| 89 | script: |
| 90 | !include-raw: |
| 91 | - tf-coverity/postbuild.groovy |