blob: 5d72ed10c73f6d88703f73df5140c53e1a648e76 [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 }
Karl Zhang02d30352020-08-20 13:48:52 +080050 dir("mbedtls") {
51 checkout(
52 changelog: false,
53 poll: false,
54 scm: [
55 $class: 'GitSCM',
56 branches: [[name: 'FETCH_HEAD']],
57 userRemoteConfigs: [[
58 refspec: 'refs/tags/$MBEDTLS_VERSION',
59 url: params.MBEDTLS_URL
60 ]]
61 ]
62 )
63 }
Tamas Ban260faf42020-06-08 16:14:55 +010064 dir("mcuboot") {
65 checkout(
66 changelog: false,
67 poll: false,
68 scm: [
69 $class: 'GitSCM',
70 branches: [[name: 'FETCH_HEAD']],
71 userRemoteConfigs: [[
72 refspec: 'refs/tags/$MCUBOOT_VERSION',
73 url: params.MCUBOOT_URL
74 ]]
75 ]
76 )
77 }
Kevin Pengb0bc0d12020-06-17 14:17:03 +080078 dir("tf-m-tests") {
79 checkout(
80 changelog: false,
81 poll: false,
82 scm: [
83 $class: 'GitSCM',
84 branches: [[name: 'FETCH_HEAD']],
85 userRemoteConfigs: [[
86 refspec: '$TFM_TESTS_REFSPEC',
87 url: params.TFM_TESTS_URL
88 ]]
89 ]
90 )
91 }
Dean Birchd0f9f8c2020-03-26 11:10:33 +000092 if (env.PSA_API_SUITE != "") {
93 dir("psa-arch-tests") {
94 checkout(
95 changelog: false,
96 poll: false,
97 scm: [
98 $class: 'GitSCM',
99 branches: [[name: 'FETCH_HEAD']],
100 userRemoteConfigs: [[
Karl Zhanga6820f22020-06-17 11:34:06 +0800101 refspec: '$PSA_ARCH_TESTS_VERSION',
Matthew Hartfb6fd362020-03-04 21:03:59 +0000102 url: params.PSA_ARCH_TESTS_URL
Dean Birchd0f9f8c2020-03-26 11:10:33 +0000103 ]]
104 ]
105 )
106 }
107 }
Dean Birch62c4f082020-01-17 16:13:26 +0000108 }
Dean Birchd0f9f8c2020-03-26 11:10:33 +0000109 try {
110 verify = 1
111 stage("Build") {
112 tee("build.log") {
113 sh "tf-m-ci-scripts/run-build.sh"
114 }
115 }
116 stage("Post") {
117 archiveArtifacts 'trusted-firmware-m/build/install/**,build.log'
118 }
119 } catch (Exception e) {
120 manager.buildFailure()
121 verify = -1
122 } finally {
123 g = new Gerrit()
124 g.verifyStatusInWorkspace(verify, env.CONFIG_NAME, 'build')
Matthew Hartfb6fd362020-03-04 21:03:59 +0000125 def buildStatus = (verify == 1) ? 'Successful' : 'Failed'
126 //g.commentInWorkspace("Build configuration ${env.CONFIG_NAME} ${buildStatus}: ${env.RUN_DISPLAY_URL}")
Dean Birch62c4f082020-01-17 16:13:26 +0000127 cleanWs()
128 }
129}