blob: 60e04d740d78709872e493308c0712dc2ee588e0 [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
Dean Birchd0f9f8c2020-03-26 11:10:33 +00009@Library('trustedfirmware') _
10import org.trustedfirmware.Gerrit
11
Karl Zhangfec84102020-06-24 09:56:36 +080012def nodeLabel = "docker-amd64-bionic"
Dean Birchd0f9f8c2020-03-26 11:10:33 +000013if (env.COMPILER == "ARMCLANG") {
Karl Zhangfec84102020-06-24 09:56:36 +080014 nodeLabel = "docker-amd64-bionic-armclang"
Dean Birchd0f9f8c2020-03-26 11:10:33 +000015}
16
17node(nodeLabel) {
Dean Birch62c4f082020-01-17 16:13:26 +000018 stage("Init") {
19 cleanWs()
20 dir("trusted-firmware-m") {
21 checkout(
22 poll: false,
23 scm: [
24 $class: 'GitSCM',
25 branches: [[name: '$GERRIT_BRANCH']],
26 extensions: [[$class: 'BuildChooserSetting', buildChooser: [$class: 'GerritTriggerBuildChooser']]],
27 userRemoteConfigs: [[
28 credentialsId: 'GIT_SSH_KEY',
29 refspec: '$GERRIT_REFSPEC', url: '$CODE_REPO'
30 ]]
31 ])
32 }
33 dir("tf-m-ci-scripts") {
Matthew Hartfb6fd362020-03-04 21:03:59 +000034 git url: '$CI_SCRIPTS_REPO', branch: '$CI_SCRIPTS_BRANCH', credentialsId: 'GIT_SSH_KEY'
Dean Birch62c4f082020-01-17 16:13:26 +000035 }
36 dir("mbed-crypto") {
37 checkout(
38 changelog: false,
39 poll: false,
40 scm: [
41 $class: 'GitSCM',
Matthew Hartfb6fd362020-03-04 21:03:59 +000042 branches: [[name: 'FETCH_HEAD']],
Dean Birch62c4f082020-01-17 16:13:26 +000043 userRemoteConfigs: [[
44 refspec: 'refs/tags/$MBEDCRYPTO_VERSION',
Dean Bircha6ede7e2020-03-13 14:00:33 +000045 url: params.MBEDCRYPTO_URL
Dean Birch62c4f082020-01-17 16:13:26 +000046 ]]
47 ]
48 )
49 }
Tamas Ban260faf42020-06-08 16:14:55 +010050 dir("mcuboot") {
51 checkout(
52 changelog: false,
53 poll: false,
54 scm: [
55 $class: 'GitSCM',
56 branches: [[name: 'FETCH_HEAD']],
57 userRemoteConfigs: [[
58 refspec: 'refs/tags/$MCUBOOT_VERSION',
59 url: params.MCUBOOT_URL
60 ]]
61 ]
62 )
63 }
Dean Birch62c4f082020-01-17 16:13:26 +000064 sh """
Dean Birch7249bfa2020-05-21 16:22:39 +010065 # Host https://github.com/Arm-software/CMSIS_5/releases/download/5.5.0/ARM.CMSIS.5.5.0.pack
66 # under \$JENKINS_HOME/userContent
67 set +e
68 wget -O cmsis.pack -q \${JENKINS_URL}/userContent/ARM.CMSIS.${CMSIS_VERSION}.pack
69 if [ "\$?" != "0" ] ; then
70 set -e
71 wget -O cmsis.pack -q https://github.com/Arm-software/CMSIS_5/releases/download/${CMSIS_VERSION}/ARM.CMSIS.${CMSIS_VERSION}.pack
72 fi
73 set -e
74 unzip -o -d CMSIS_5 cmsis.pack
75 """
Kevin Pengb0bc0d12020-06-17 14:17:03 +080076 dir("tf-m-tests") {
77 checkout(
78 changelog: false,
79 poll: false,
80 scm: [
81 $class: 'GitSCM',
82 branches: [[name: 'FETCH_HEAD']],
83 userRemoteConfigs: [[
84 refspec: '$TFM_TESTS_REFSPEC',
85 url: params.TFM_TESTS_URL
86 ]]
87 ]
88 )
89 }
Dean Birchd0f9f8c2020-03-26 11:10:33 +000090 if (env.PSA_API_SUITE != "") {
91 dir("psa-arch-tests") {
92 checkout(
93 changelog: false,
94 poll: false,
95 scm: [
96 $class: 'GitSCM',
97 branches: [[name: 'FETCH_HEAD']],
98 userRemoteConfigs: [[
Karl Zhanga6820f22020-06-17 11:34:06 +080099 refspec: '$PSA_ARCH_TESTS_VERSION',
Matthew Hartfb6fd362020-03-04 21:03:59 +0000100 url: params.PSA_ARCH_TESTS_URL
Dean Birchd0f9f8c2020-03-26 11:10:33 +0000101 ]]
102 ]
103 )
104 }
105 }
Dean Birch62c4f082020-01-17 16:13:26 +0000106 }
Dean Birchd0f9f8c2020-03-26 11:10:33 +0000107 try {
108 verify = 1
109 stage("Build") {
110 tee("build.log") {
111 sh "tf-m-ci-scripts/run-build.sh"
112 }
113 }
114 stage("Post") {
115 archiveArtifacts 'trusted-firmware-m/build/install/**,build.log'
116 }
117 } catch (Exception e) {
118 manager.buildFailure()
119 verify = -1
120 } finally {
121 g = new Gerrit()
122 g.verifyStatusInWorkspace(verify, env.CONFIG_NAME, 'build')
Matthew Hartfb6fd362020-03-04 21:03:59 +0000123 def buildStatus = (verify == 1) ? 'Successful' : 'Failed'
124 //g.commentInWorkspace("Build configuration ${env.CONFIG_NAME} ${buildStatus}: ${env.RUN_DISPLAY_URL}")
Dean Birch62c4f082020-01-17 16:13:26 +0000125 cleanWs()
126 }
127}