blob: eacdc3a27fda6b1a1d416a665623e29e8d86a2b6 [file] [log] [blame]
Dean Birch62c4f082020-01-17 16:13:26 +00001#!/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
9def verifyStatus(value, stage_name) {
10 withCredentials([usernamePassword(credentialsId: 'VERIFY_STATUS', passwordVariable: 'VERIFY_PASSWORD', usernameVariable: 'VERIFY_USER')]) {
11 sh """
12if [ -z "\$GERRIT_HOST" ] ; then
13 echo Not running for a Gerrit change, skipping vote.
14 exit 0
15fi
16if [ ! -d venv ] ; then
17 virtualenv -p \$(which python3) venv
18fi
19. venv/bin/activate
20pip -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
26node("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 """
60wget -O cmsis.pack -q https://github.com/ARM-software/CMSIS_5/releases/download/${CMSIS_VERSION}/ARM.CMSIS.${CMSIS_VERSION}.pack
61unzip -o -d CMSIS_5 cmsis.pack
62"""
63 }
64 stage("Check") {
65 def verify = 1
66 try {
67 sh """
68cd trusted-firmware-m
69export GIT_REF_ARG=""
70if [ ! -z "\$GERRIT_PATCHSET_REVISION" ] ; then
71 export GIT_REF_ARG="HEAD"
72fi
73../tf-m-ci-scripts/run-cppcheck.sh -r \$GIT_REF_ARG
74"""
75 } catch (Exception e) {
76 manager.buildFailure()
77 verify = -1
78 } finally {
79 verifyStatus(verify, 'cppcheck')
80 cleanWs()
81 }
82 }
83}