blob: 6ce22b483358cb182355fadcba13f4aa4e8a8c8a [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',
Dean Bircha6ede7e2020-03-13 14:00:33 +000054 url: params.MBEDCRYPTO_URL
Dean Birch62c4f082020-01-17 16:13:26 +000055 ]]
56 ]
57 )
58 }
59 sh """
Dean Bircha6ede7e2020-03-13 14:00:33 +000060# Host https://github.com/Arm-software/CMSIS_5/releases/download/5.5.0/ARM.CMSIS.5.5.0.pack
61# under \$JENKINS_HOME/userContent
62wget -O cmsis.pack -q \${JENKINS_URL}/userContent/ARM.CMSIS.${CMSIS_VERSION}.pack
Dean Birch62c4f082020-01-17 16:13:26 +000063unzip -o -d CMSIS_5 cmsis.pack
64"""
65 }
66 stage("Check") {
67 def verify = 1
68 try {
69 sh """
70cd trusted-firmware-m
71export GIT_REF_ARG=""
72if [ ! -z "\$GERRIT_PATCHSET_REVISION" ] ; then
73 export GIT_REF_ARG="HEAD"
74fi
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}