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', |
| 54 | url: 'https://github.com/ARMmbed/mbed-crypto.git' |
| 55 | ]] |
| 56 | ] |
| 57 | ) |
| 58 | } |
| 59 | sh """ |
| 60 | wget -O cmsis.pack -q https://github.com/ARM-software/CMSIS_5/releases/download/${CMSIS_VERSION}/ARM.CMSIS.${CMSIS_VERSION}.pack |
| 61 | unzip -o -d CMSIS_5 cmsis.pack |
| 62 | """ |
| 63 | } |
| 64 | stage("Check") { |
| 65 | def verify = 1 |
| 66 | try { |
| 67 | sh """ |
| 68 | cd trusted-firmware-m |
| 69 | ../tf-m-ci-scripts/run-checkpatch.sh -u |
| 70 | ../tf-m-ci-scripts/run-checkpatch.sh -r -l 1 |
| 71 | """ |
| 72 | } catch (Exception e) { |
| 73 | manager.buildFailure() |
| 74 | verify = -1 |
| 75 | } finally { |
| 76 | verifyStatus(verify, 'checkpatch') |
| 77 | cleanWs() |
| 78 | } |
| 79 | } |
| 80 | } |