Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 1 | #!/usr/bin/env groovy |
| 2 | //------------------------------------------------------------------------------- |
| 3 | // Copyright (c) 2020, Arm Limited and Contributors. All rights reserved. |
| 4 | // |
| 5 | // SPDX-License-Identifier: BSD-3-Clause |
| 6 | // |
| 7 | //------------------------------------------------------------------------------- |
| 8 | |
| 9 | def verifyStatus(value, stage_name) { |
| 10 | withCredentials([usernamePassword(credentialsId: 'VERIFY_STATUS', passwordVariable: 'VERIFY_PASSWORD', usernameVariable: 'VERIFY_USER')]) { |
| 11 | sh """ |
| 12 | if [ -z "\$GERRIT_HOST" ] ; then |
| 13 | echo Not running for a Gerrit change, skipping vote. |
| 14 | exit 0 |
| 15 | fi |
| 16 | if [ ! -d venv ] ; then |
| 17 | virtualenv -p \$(which python3) venv |
| 18 | fi |
| 19 | . venv/bin/activate |
| 20 | pip -q install requests |
| 21 | ./tf-m-ci-scripts/jenkins/verify.py --value ${value} --verify-name tf-m-${stage_name} --user \$VERIFY_USER |
| 22 | """ |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | node("docker-amd64-xenial") { |
| 27 | stage("Init") { |
| 28 | cleanWs() |
| 29 | dir("trusted-firmware-m") { |
| 30 | checkout( |
| 31 | poll: false, |
| 32 | scm: [ |
| 33 | $class: 'GitSCM', |
| 34 | branches: [[name: '$GERRIT_BRANCH']], |
| 35 | extensions: [[$class: 'BuildChooserSetting', buildChooser: [$class: 'GerritTriggerBuildChooser']]], |
| 36 | userRemoteConfigs: [[ |
| 37 | credentialsId: 'GIT_SSH_KEY', |
| 38 | refspec: '$GERRIT_REFSPEC', url: '$CODE_REPO' |
| 39 | ]] |
| 40 | ]) |
| 41 | } |
| 42 | dir("tf-m-ci-scripts") { |
| 43 | git url: '$CI_SCRIPTS_REPO', branch: 'master', credentialsId: 'GIT_SSH_KEY' |
| 44 | } |
| 45 | dir("mbed-crypto") { |
| 46 | checkout( |
| 47 | changelog: false, |
| 48 | poll: false, |
| 49 | scm: [ |
| 50 | $class: 'GitSCM', |
| 51 | branches: [[name: 'FETCH_HEAD']], |
| 52 | userRemoteConfigs: [[ |
| 53 | refspec: 'refs/tags/$MBEDCRYPTO_VERSION', |
Dean Birch | a6ede7e | 2020-03-13 14:00:33 +0000 | [diff] [blame^] | 54 | url: params.MBEDCRYPTO_URL |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 55 | ]] |
| 56 | ] |
| 57 | ) |
| 58 | } |
| 59 | sh """ |
Dean Birch | a6ede7e | 2020-03-13 14:00:33 +0000 | [diff] [blame^] | 60 | # Host https://github.com/Arm-software/CMSIS_5/releases/download/5.5.0/ARM.CMSIS.5.5.0.pack |
| 61 | # under \$JENKINS_HOME/userContent |
| 62 | wget -O cmsis.pack -q \${JENKINS_URL}/userContent/ARM.CMSIS.${CMSIS_VERSION}.pack |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 63 | unzip -o -d CMSIS_5 cmsis.pack |
| 64 | """ |
| 65 | } |
| 66 | stage("Check") { |
| 67 | def verify = 1 |
| 68 | try { |
| 69 | sh """ |
| 70 | cd trusted-firmware-m |
| 71 | export GIT_REF_ARG="" |
| 72 | if [ ! -z "\$GERRIT_PATCHSET_REVISION" ] ; then |
| 73 | export GIT_REF_ARG="HEAD" |
| 74 | fi |
| 75 | ../tf-m-ci-scripts/run-cppcheck.sh -r \$GIT_REF_ARG |
| 76 | """ |
| 77 | } catch (Exception e) { |
| 78 | manager.buildFailure() |
| 79 | verify = -1 |
| 80 | } finally { |
| 81 | verifyStatus(verify, 'cppcheck') |
| 82 | cleanWs() |
| 83 | } |
| 84 | } |
| 85 | } |